Closed orblazer closed 1 year ago
Hi @orblazer ! Thanks for opening this issue.
This behavior is a limitation of Ansible itself; those variables only apply to plugins, not modules.
You can see this in the documentation by comparing for example the vault_read
lookup:
The good news is that to help with this, we have a special lookup plugin, vault_ansible_settings
which can be used to get the same settings that would be used in a lookup, and then apply those to module_defaults
.
Have a look at the examples in that link, and let me know if that's helpful for you.
Ok thanks, so the documentation for vault_write module and vault_read module is not clear because its say token param -> ansible var -> ANSIBLE_HASHI_VAULT_TOKEN -> VAULT_TOKEN -> token file
, so for me ansible var
took the facts ansible_hashi_vault_addr
and ansible_hashi_vault_token
.
I see; the description is shared between all modules and plugins, which is why it shows up the same for all.
I've opened an issue to update that to make it clearer:
SUMMARY
Arguments
url
andtoken
still required when use modules and the variablesansible_hashi_vault_addr
andansible_hashi_vault_token
is defined.ISSUE TYPE
COMPONENT NAME
vault_read
vault_write
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
Work great without need add
url
andtoken
,ACTUAL RESULTS
Throw error
Required option url was not set
orNo Vault Token specified or discovered.
.