diff options
author | Pilou <pierre-louis.bonicoli@libregerbil.fr> | 2019-06-11 16:25:41 +0200 |
---|---|---|
committer | AlanCoding <arominge@redhat.com> | 2019-09-27 20:29:01 +0200 |
commit | 934d7d62efde899595fb6b1781e032ff579f18f0 (patch) | |
tree | 1a9ee40c77ea624447850ac0e7354b48aab26b78 | |
parent | tower_user: Fix to create a system auditor properly (#54585) (diff) | |
download | awx-934d7d62efde899595fb6b1781e032ff579f18f0.tar.xz awx-934d7d62efde899595fb6b1781e032ff579f18f0.zip |
fix tower_credential example: lookup are run on controller (#57516)
- don't advise to use lookups in order to fetch path on managed nodes
- fix example:
- use slurp instead 'file' lookup
- remove extraneous brackets
-rw-r--r-- | lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py index 32c9cf817f..d82ccb9b92 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py @@ -165,10 +165,14 @@ EXAMPLES = ''' ssh_key_data: "{{ lookup('file', '/tmp/id_rsa') }}" ssh_key_unlock: "passphrase" +- name: Fetch private key + slurp: + src: '$HOME/.ssh/aws-private.pem' + register: aws_ssh_key - name: Add Credential Into Tower tower_credential: name: Workshop Credential - ssh_key_data: "{{ lookup('file', '/home/' ~ {{ansible_user}} ~ '/.ssh/aws-private.pem') }}" + ssh_key_data: "{{ aws_ssh_key['content'] | b64decode }}" kind: ssh organization: Default tower_username: admin @@ -311,7 +315,7 @@ def main(): data = module.params.get('ssh_key_data') if os.path.exists(data): module.deprecate( - msg='ssh_key_data should be a string, not a path to a file. Use lookup(\'file\', \'/path/to/file\') instead', + msg='ssh_key_data should be a string, not a path to a file.', version="2.12" ) if os.path.isdir(data): |