Ian Wienand
39945b8570
Make query with errors='ignore' return a blank list ( #57038 )
...
The jinja2 query() function (or lookup with wantslist=True, which is
the same thing) should always return a list.
However, if you combine a query with errors='ignore' and take the
error path, the current code returns a None value. This is important
in a case such as
- name: Conditional include file
import_tasks: '{{ item }}'
vars:
params:
files:
- path/file1.yaml
- path/file2.yaml
loop: "{{ q('first_found', params, errors='ignore') }}"
If neither file1.yaml or file2.yaml exist, this should do nothing by
returning an empty list to the loop. Currently if you run the above
task you'll get a rather unhelpful:
Invalid data passed to 'loop', it requires a list, got this instead: .
This change ensures that when a query ignores an error, it returns a
empty list. The errors='ignore' case is tested in several variants
with first_found. The extant (but deprecated) "skip: True" for
first_found doesn't seem to be explicitly tested; a test is added here
to avoid regressions before removal in 2.12.
This fixes a regression you'll hit if you follow the suggestion in the
deprecation message included with
e17a2b502d
to use errors=ignore over
"skip: True" for first_found. This change adds an example that points
out the query/lookup difference and also fixes the error message to
not mention the now deprecated "skip: True".
Closes #56775
2019-05-29 13:23:02 -04:00
Jake Scaltreto
3e8ca0285f
lookup: consul_kv: Add datacenter parameter ( #56647 )
2019-05-22 08:02:39 +02:00
Martin Krizek
34e9d6781b
Templar: encapsulate _available_variables ( #55435 )
...
Ensure variables are reset between iterations
2019-05-20 11:49:54 -04:00
Martin Krizek
f37476e247
template lookup: restore variables between calls ( #55126 )
...
* template lookup: restore variables between calls
Fixes #55113
* Address issues from the review
2019-04-30 15:22:37 -04:00
John Mahowald
9c038b210b
Fix template lookup description ( #55557 )
...
Previously, template lookup description was documented as "mostly a noop".
Now, describe that it returns template content with substituted variables.
2019-04-25 17:16:53 -05:00
Sloane Hertel
afb5e02c19
preserve same order as inventory manager when using host lookup ( #55331 )
...
* preserve same order as inventory manager when using inventory_hostnames lookup
add a test
* move generic code
2019-04-18 15:54:03 -04:00
Dmitriusan
f40778cae3
Update documentation of filetree to mention limits of 'src' attribute ( #54347 )
...
* Filetree plugin does not return the 'src' attribute when `item.state` is set to `directory`
Error is `'dict object' has no attribute 'src'`. See https://github.com/ansible/ansible/issues/51513#issuecomment-459150769 .
* Update filetree.py
2019-04-11 16:39:56 -05:00
Keith Maxwell
889024e101
Clarify example for fileglob lookup plugin ( #54941 )
...
fileglob returns a list of paths it does not return file contents, as explained in latest notes. The file lookup retrieves file contents. This change clarifies the first example to make it clear a paths, not contents, are returned.
It also adds spaces around the lookup to avoid E206 from ansible-lint: "Variables should have spaces before and after: {{ var_name }}"
+label: docsite_pr
2019-04-07 16:24:48 +01:00
Julian
dafdcf286a
passwordstore: add hint for subkey=password ( #54221 )
...
Clarify that subkey=password will always return the first line. Adding a YAML style subkey called "password" is not possible.
2019-04-05 15:11:14 -05:00
James Cassell
bc4ef99533
standardize TLS connection properties ( #54315 )
...
* openstack: standardize tls params
* tower: tower_verify_ssl->validate_certs
* docker: use standard tls config params
- cacert_path -> ca_cert
- cert_path -> client_cert
- key_path -> client_key
- tls_verify -> validate_certs
* k8s: standardize tls connection params
- verify_ssl -> validate_certs
- ssl_ca_cert -> ca_cert
- cert_file -> client_cert
- key_file -> client_key
* ingate: verify_ssl -> validate_certs
* manageiq: standardize tls params
- verify_ssl -> validate_certs
- ca_bundle_path -> ca_cert
* mysql: standardize tls params
- ssl_ca -> ca_cert
- ssl_cert -> client_cert
- ssl_key -> client_key
* nios: ssl_verify -> validate_certs
* postgresql: ssl_rootcert -> ca_cert
* rabbitmq: standardize tls params
- cacert -> ca_cert
- cert -> client_cert
- key -> client_key
* rackspace: verify_ssl -> validate_certs
* vca: verify_certs -> validate_certs
* kubevirt_cdi_upload: upload_host_verify_ssl -> upload_host_validate_certs
* lxd: standardize tls params
- key_file -> client_key
- cert_file -> client_cert
* get_certificate: ca_certs -> ca_cert
* get_certificate.py: clarify one or more certs in a file
Co-Authored-By: jamescassell <code@james.cassell.me>
* zabbix: tls_issuer -> ca_cert
* bigip_device_auth_ldap: standardize tls params
- ssl_check_peer -> validate_certs
- ssl_client_cert -> client_cert
- ssl_client_key -> client_key
- ssl_ca_cert -> ca_cert
* vdirect: vdirect_validate_certs -> validate_certs
* mqtt: standardize tls params
- ca_certs -> ca_cert
- certfile -> client_cert
- keyfile -> client_key
* pulp_repo: standardize tls params
remove `importer_ssl` prefix
* rhn_register: sslcacert -> ca_cert
* yum_repository: standardize tls params
The fix for yum_repository is not straightforward since this module is
only a thin wrapper for the underlying commands and config. In this
case, we add the new values as aliases, keeping the old as primary,
only due to the internal structure of the module.
Aliases added:
- sslcacert -> ca_cert
- sslclientcert -> client_cert
- sslclientkey -> client_key
- sslverify -> validate_certs
* gitlab_hook: enable_ssl_verification -> hook_validate_certs
* Adjust arguments for docker_swarm inventory plugin.
* foreman callback: standardize tls params
- ssl_cert -> client_cert
- ssl_key -> client_key
* grafana_annotations: validate_grafana_certs -> validate_certs
* nrdp callback: validate_nrdp_certs -> validate_certs
* kubectl connection: standardize tls params
- kubectl_cert_file -> client_cert
- kubectl_key_file -> client_key
- kubectl_ssl_ca_cert -> ca_cert
- kubectl_verify_ssl -> validate_certs
* oc connection: standardize tls params
- oc_cert_file -> client_cert
- oc_key_file -> client_key
- oc_ssl_ca_cert -> ca_cert
- oc_verify_ssl -> validate_certs
* psrp connection: cert_trust_path -> ca_cert
TODO: cert_validation -> validate_certs (multi-valued vs bool)
* k8s inventory: standardize tls params
- cert_file -> client_cert
- key_file -> client_key
- ca_cert -> ca_cert
- verify_ssl -> validate_certs
* openshift inventory: standardize tls params
- cert_file -> client_cert
- key_file -> client_key
- ca_cert -> ca_cert
- verify_ssl -> validate_certs
* tower inventory: verify_ssl -> validate_certs
* hashi_vault lookup: cacert -> ca_cert
* k8s lookup: standardize tls params
- cert_file -> client_cert
- key_file -> client_key
- ca_cert -> ca_cert
- verify_ssl -> validate_certs
* laps_passord lookup: cacert_file -> ca_cert
* changelog for TLS parameter standardization
2019-03-28 00:19:28 -05:00
Kyryl Galanov
4a5b9bd8eb
New lookup module: manifold ( #50435 )
...
* New lookup module: manifold
Add Manifold.co integration. The plugin fetches resource credentials
from Manifold service.
* module manifold: fix ansible lint warnings
* module manifold: fix false warning - split test assertion
* manifold module: fix unittest import
* manifold module: fix unittest patch
* manifold module: fix python3 requests getheader error
2019-03-27 07:20:15 -04:00
Tom Cooper
2b6413558b
hashi_vault: Use mount_point kwarg for ldap/userpass login ( #54358 )
...
Fixes : #54249
2019-03-27 09:41:09 +05:30
Sloane Hertel
54be769e8d
fix AWS plugin credential precedence for environment variables ( #52945 )
...
* fix AWS plugin credential precedence for environment variables
* Allow aliases in direct plugins options
Consolidate precedence fix just in the doc fragment using aliases for mismatched options
* Access options with the option name rather than alias
* fix indentation
* update unit tests
* Improve readability
2019-03-25 16:53:11 -04:00
Vlad Romanenko
e216aafc14
Fix syntax highlighting ( #53945 )
...
* Fix syntax highlighting
This fixes broken syntax highlighting for \' inside a single quoted string.
* Update lib/ansible/plugins/lookup/aws_ssm.py
Co-Authored-By: vlad-ro <vlad-ro@users.noreply.github.com>
2019-03-21 17:08:23 +00:00
Vlad Romanenko
fc2ad0e9de
[aws_ssm lookup plugin] Add example of using explicit aws credentials ( #53956 )
2019-03-18 09:38:08 -05:00
Rémi REY
c6aecf4704
Update aws_secret.py ( #53390 )
...
Update the version_added variable that should be 2.8
2019-03-06 13:31:55 -05:00
Martin Krizek
5734b4e69e
Clarify return value of the sequence lookup ( #53275 )
...
* Clarify return value of the sequence lookup
Fixes #17852
* Mention range filter
2019-03-04 14:09:55 -05:00
Jad Kik
79eeea8ea6
lookup: redis: fix plugin returning repr'd byte objects ( #52854 )
...
* Fix default port of redis lookup plugin
* Fix redis plugin returning repr'd byte objects
* Fix error handling in redis lookup plugin
2019-02-27 12:04:18 +01:00
Brian Coca
cd63a0714b
varnames lookup ( #51621 )
...
* varnames lookup
* doc updates from feedback lib/ansible/plugins/lookup/varnames.py
Co-Authored-By: bcoca <bcoca@users.noreply.github.com>
2019-02-26 13:59:24 -05:00
Rémi REY
30b3ce0f81
Add aws_secret module for managing secretsmanager on AWS ( #48486 )
...
* Adding module for managing AWS Secrets Manager resources
* adding aws_secret lookup plugin
Also use the data returned by describe_secret everywhere.
* replace the explicit /root use by a temporary dir
* aws_secret: rework module
Reworked module to use a class avoiding using client and module in every
functions.
* Added support of "recovery_window" parameter to allow user to provide
recovery period.
* updated return value to be the api output providing more details about
the secret.
* Fix Python 3 bug in tests if the role is not removed
* Add unsupported alias due to issue restricting resource for creating secrets
2019-02-25 14:27:33 -06:00
Jordan Borean
9717bc4bcf
Add laps_password lookup for retrieving a Windows LAPS Password ( #52012 )
...
* Add laps_password lookup for retrieving a Windows LAPS Password
* Remove python-ldap from requirements and fix doc typos
* enable unit tests without ldap dependency
* use config options for lookup plugin
* Update docs and tests based on further distro testing
2019-02-25 05:30:12 +10:00
John R Barker
b3a3328ea6
Better document the return type of the fileglob filter ( #52801 )
...
https://github.com/ansible/ansible/pull/44986
Fixes #33465
Thanks to DaveB93 for the suggestion.
2019-02-22 10:23:15 +00:00
Sumit Jaiswal
8a2ff1cde6
PR to start support for Skydive integration with Ansible ( #50857 )
...
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive modules
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* modifying file name
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* renamed
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* skydive lookup
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* change in str
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* change in str
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable error
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* renamed file
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable error
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* change in str
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable error
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable error
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix review comments
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix review comments
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* deleting file to add to new PR
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix review comments
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* shippable and doc fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* placing doc at correct path
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* shippable and doc fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* placing doc at correct path
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* updated with review and shippable fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* updated with review and shippable fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* updated with review and shippable fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* updated with review and shippable fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fixing review comment
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fixing review comment
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fixing review comment
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fixing review comment
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fixing review comment
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable errors
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix shippable error
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix review comments
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fixing shippable errors
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* fix review comments
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* review comments
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* shippable fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
* review comment
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
2019-02-19 16:18:40 +05:30
Alex Vasilenko
20ed819acd
Fix exception handling in credtash lookup ( #51099 )
...
Exception does not have property message and ansible returns completely different exception because of this
2019-02-18 18:28:35 -05:00
Emmanouil Kampitakis
1219aa811a
Feature/alphanumeric password in passwordstore ( #38121 )
...
* Alphanumeric only password may be generated
* Bump the ansible version this will have been added to 2.8
2019-02-14 17:02:24 -05:00
Abhijeet Kasurde
32fce43311
hashi_vault: fix multiple spaces in params ( #51524 )
...
Fixes param parsing in hashi_vault
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-13 18:32:00 +05:30
Jadi
bf40b8d118
Fixed wrong limit on 'Fetch all deployments' sample ( #51897 )
...
Fixes : #51675
the sample for 'Fetch all deployments' is "{{ lookup('k8s', kind='Deployment', namespace='testing') }}" but it should be "{{ lookup('k8s', kind='Deployment') }}"
2019-02-08 08:17:50 +05:30
Abhijeet Kasurde
18ed84b877
hashi_vault: add support for userpass authentication ( #51538 )
...
Added support for username and password authentication in hashi_vault
lookup plugin.
Fixes : #38878
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-02 12:32:53 +01:00
Abhijeet Kasurde
67f95cb499
Onepassword document fixes ( #51527 )
...
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-01-31 09:48:55 -05:00
Fabian von Feilitzsch
09bfe42a5c
Bubble up import exception content for k8s module ( #50657 )
...
* Bubble up import exception content for k8s module
Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
* Track down other places import exception is reported
* Add changelog fragment
2019-01-15 10:44:59 +10:00
Semyon Deviatkin
618caf2168
add env variable VAULT_AUTH_METHOD ( #50572 )
2019-01-07 22:13:00 +01:00
Martin Krizek
6d604f9b01
Allow for vaulted templates in template lookup ( #49819 )
...
Fixes #34209
2019-01-07 10:06:01 -05:00
Martin Krizek
82c95e07b5
Fix searchpath in the template lookup ( #50488 )
2019-01-07 11:33:39 +01:00
Arne Jørgensen
15fb9d3bc0
Fix lastpass lookup error
...
Fixes #42062 .
2019-01-03 23:56:41 -08:00
drewmullen
04a9a887d5
allow for vault enterprise namespaces ( #50462 )
...
* enable namespaces feature for hashi_vault lookup
* include version_added dict in options documentation
2019-01-03 11:51:13 -05:00
Richlv
bb9bad89bb
Update ini.py ( #50171 )
...
Typo/grammar/consistency fixes.
2018-12-20 10:07:05 -05:00
Yannig Perré
6b41588e93
Fix with_ini example and unittest
...
* Fix example in ini.py
* Fix unittest in test_ini.py to pass CI as latest ansible returns list in
different order. To prevent such issues in future results are sorted
* PEP8 E501 styling improvements
Co-Authored-By: Sergii Golovatiuk <sgolovat@redhat.com>
2018-12-18 12:25:02 -08:00
Toshio Kuratomi
3fba006207
Update bare exceptions to specify Exception.
...
This will keep us from accidentally catching program-exiting exceptions
like KeyboardInterupt and SystemExit.
2018-12-16 15:03:19 -08:00
Chad Anderson
6ff7797eaa
Move verify up so approle and other methods work as intended.
2018-12-14 11:14:12 -08:00
Abhijeet Kasurde
013c42b14f
Misc typo fixes ( #49816 )
...
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-14 15:12:58 +05:30
Abhijeet Kasurde
e464c543f6
Add support for variable_{start,end}_string ( #49711 )
...
Template lookup plugin now support variable_start_string and
variable_end_string, just like template module.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-11 15:22:12 +05:30
Brian Coca
e17a2b502d
updated ff docs to include and deprecate skip ( #45167 )
...
* updated ff docs to include and deprecate skip
* fine tuned requires
* deprecate
* fixes
2018-12-05 12:08:30 -05:00
spike77453
bd35069495
Non-existent RR returns empty string ( #40680 )
2018-11-29 14:58:16 +00:00
Matt Martz
9773a1f289
Add a Singleton metaclass, use it with Display ( #48935 )
...
* Add a Singleton class, use it with Display
* update six import
* Move remaining failes to display singleton
* Fix rebase issues
* Singleton improvements
* Add code-smell for 'from __main__ import display'. ci_complete
* s/self/cls/g
* Add docs for no-main-display
* Address linting issues
* Add changelog fragment. ci_complete
* Implement reentrant lock for class instantiation in Singleton
* Add Display singleton porting guide
2018-11-20 17:06:51 -06:00
Martin Krizek
a80c25cbd9
Do not use str() on exceptions ( #46950 )
2018-11-09 07:59:30 +01:00
James E. King III
3a4ee965f5
Improve debug logging of filetree with path being walked and items found ( #47884 )
2018-11-07 21:32:23 +01:00
Gaël Lambert
0c95453a70
Doc: k8s_raw_module fixing typo K8S_AUTH_HOST -> K8S_AUTH_KEY_FILE ( #46947 )
...
The current doc of k8s_raw_module contain a copy paste of the env var name :
```
host :
Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
key_file : Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_HOST environment variable.
```
2018-11-05 12:13:57 -05:00
Dmitry Polyakovsky
5b27de41bd
fixed parentheses ( #48067 )
...
* fixed parentheses
* Add space after lookup
2018-11-05 12:42:54 +01:00
Will Thames
2b02e43614
Document template plugin's convert_data option
...
This is a useful option that I can never remember the name of
2018-11-02 16:09:51 -04:00
Toshio Kuratomi
9906daa83c
Fix password lookup for FIPS
...
Fixes #47297
2018-10-31 12:50:23 -07:00