-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vault encrypted secrets in the inventory source not working when nested in lists #2226
Comments
Would you mind providing more detail on your directory structure? I'm reading that you probably put a host_vars folder next to your playbook. If that's the case, then I don't yet see how anything could behave differently for the Ansible CLI versus AWX, but there are probably some details I'm missing. |
Hi Alan, I just managed to create a minimal example able to reproduce the problem. Create a project:
Create an inventory:
Add an inventory source to the previous inventory:
Start sync on the project Create a vault credential:
Create a new job template:
Run the Job Template from AWX. The console output is:
Instead, if you run it from the command line using (note:
you get the correct output:
I hope this can help you in tracking the problem. |
Thank you for that very detailed information. Proposed fix up at: This doesn't necessarily belong in the AWX issue queue, once I dug, I was able to replicate the issue via the command line. The usage difference between your CLI use and AWX use is that AWX goes through a YAML->JSON conversion of the variables. Indeed, when you give this data as JSON, Ansible CLI fails to decrypt it. This is why use inside of AWX hit the bug whereas the direct CLI use did not. |
Looks like Ansible core devs have have agreed on the solution. Fix should be landing in development Ansible soon. |
Fix was merged into development Ansible, and is slated for 2.8 release. |
ISSUE TYPE
COMPONENT NAME
SUMMARY
Experimenting with #223 I noticed a strange behaviour related to vaulted variables on lists, where the decryption is not performed. The behaviour can be observed on AWX only: running the playbook directly on Ansible the decryption works.
ENVIRONMENT
STEPS TO REPRODUCE
I have an host vars file with the same secret in 3 different situations:
A simple playbook can be run, with 3 debug tasks:
EXPECTED RESULTS
The expected result, obtained using plain Ansible 2.6.2 without AWX, is the following:
ACTUAL RESULTS
The result obtained by running the 3 tasks on a Job Template from AWX is the following, and the problem seems related to the vaulted variable nested in the list:
ADDITIONAL INFORMATION
Waiting for a fix, a workaround to force the decryption of the 3rd password would be appreciated
The text was updated successfully, but these errors were encountered: