Open janorn opened 10 months ago
I ran into a similar situation (not using a constructed inventory, but one sources from a plugin dynamically). If the plugin requires credentials for, e.g., an external API, it will fail.
The UI even has an option to select secrets, but this does not offer to select Vault secrets. The API call seems to filter for credentials of kind "cloud". Also, the code building the ansible-inventory
call does not have any logic to include a vault secret, as far as I can see anyway.
Please confirm the following
security@ansible.com
instead.)Bug Summary
The following constructed inventory will fail if the tested variable is containing encrypted data.
If a host_vars contains this it will fail:
AWX version
23.4.0
Select the relevant components
Installation method
kubernetes
Modifications
no
Ansible version
-
Operating system
-
Web browser
Edge
Steps to reproduce
You can find a complete test inventory here: https://github.com/janorn/awx_inventory.git
Us it and create a constructed inventory with the following config:
Hit sync and it will fail.
Expected results
A new inventory with only two hosts
Actual results
'{'name': 'host2', 'password': '{{ test_secret }}'}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ test_secret_vault }}'. Error was a <class 'ansible.parsing.vault.AnsibleVaultError'>, original message: Attempting to decrypt but no vault secrets found . Could not add host host2 to group dict_group: An unhandled exception occurred while templating '{'name': 'host2', 'password': '{{ test_secret }}'}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ test_secret_vault }}'. Error was a <class 'ansible.parsing.vault.AnsibleVaultError'>, original message: Attempting to decrypt but no vault secrets found [WARNING]: * Failed to parse /runner/inventory/constructed.yml with script plugin: problem running /runner/inventory/constructed.yml --list ([Errno 8] Exec format error: '/runner/inventory/constructed.yml') ERROR! Completely failed to parse inventory source /runner/inventory/constructed.yml
Additional information