Reputation: 21
I'm trying to check what value Ansible pulls for the variable datadog_agent_api_key
that is currently stored in Ansible Vault file inventory/common/vault-common-vars.yml
.
ansible myhost.domain.com -i inventory/hosts.ini --connection=local -m debug -a var=datadog_agent_api_key --include_vars=inventory/common/vault-common-vars.yml
When I run it, I am getting the error
ansible: error: unrecognized arguments: --include_vars=inventory/common/vault-common-vars.yml
If the variable is not in Ansible Vault, it pulls the value correctly.
ansible myhost.domain.com -i inventory/hosts.ini --connection=local -m debug -a var=datadog_agent_system_probe_enabled
myhost.domain.com | SUCCESS => {
"datadog_agent_system_probe_enabled": true
What's the proper options to use or is there a different way to do this?
Upvotes: 2
Views: 598
Reputation: 17017
include_vars is a module not an option.
if you want to see the content of a vault file use:
ansible-vault view nameoffile --ask-vault-pass
the option --ask-vault-pass
-> a prompt to ask the password of encrypted file
if you want to launch from a command line use:
ansible localhost -m include_vars -a file=inventory/common/vault-common-vars.yml --ask-vault-pass
Upvotes: 1