How can I use the AWX credential variables in playbooks?
Im specifically looking to re-use the AWS Credential keys in a playbook that uses ‘ec2_instance_facts’ which requires the passing of the keys in order to work.
Thanks!
Brent
How can I use the AWX credential variables in playbooks?
Im specifically looking to re-use the AWS Credential keys in a playbook that uses ‘ec2_instance_facts’ which requires the passing of the keys in order to work.
Thanks!
Brent
In the case of the AWS credentials they’ll be attached to a job run using the standard environment variables that the ec2 modules expect: AWS_ACCESS_KEY and AWS_SECRET_KEY
I must be doing something wrong or mis-understanding how to access the variable.
My Example,
I realized after posting below, that I was not using the variable for the secret like you mentioned. I fixed the code and reran it.
I changed my code from “AWS_SECRET_ACCESS_KEY” to “AWS_SECRET_KEY”
You need to look up the environment variables, they aren’t added as extra vars:
https://docs.ansible.com/ansible/2.5/plugins/lookup/env.html
I will point out, however, that the ec2 modules use boto which will automatically pick them up out of the environment… have you tried running the playbook in AWX without setting aws_access_key and aws_secret_key?
I will give the env thing a try.
When I run the AWX job without setting aws_access_key and aws_secret_key I get this error
NoCredentialsError: Unable to locate credentials
This is what I finally got to work. Many thanks for the help and direciton