Dynamic Inventory API keys in Vault

Hi All,

Is it possible to access variables stored in vault from a dynamic inventory script?

Problem: I need to create a dynamic inventory composed of multiple accounts from multiple providers and would like to key several API keys in vault.

Any hints, patterns or pertinent areas of the source code to look at will be gratefully received.

Regards,

Anthony.

key several API keys in vault.

*keep several API keys in vault.

Problem: I need to create a dynamic inventory composed of multiple accounts from multiple providers and would like to keep several API keys in vault.

Any hints, patterns or pertinent areas of the source code to look at will be gratefully received.

Have you read http://docs.ansible.com/ansible/playbooks_vault.html ?

This sounds like it belongs to ansible-project rather than ansible-devel.

Cheers,
Paul

Have you read http://docs.ansible.com/ansible/playbooks_vault.html ?

Actually http://docs.ansible.com/ansible/playbooks_best_practices.html#variables-and-vaults as well.

Have you read http://docs.ansible.com/ansible/playbooks_vault.html ?

Actually http://docs.ansible.com/ansible/playbooks_best_practices.html#variables-and-vaults as well.

Hi Paul, thanks for the quick response. Yes, I’ve read these. I’m comfortable with using vault in the ways described in the docs. My question is more about accessing variables from vault via the python API within a dynamic inventory.

Though, if I have missed something blatant in the docs please point it out,

Regards,

Anthony.

I’d suggest having a look at

http://docs.ansible.com/ansible/developing_api.html#id3

and perhaps the vault cli implementation in lib/ansible/cli/vault.py

Jon

thanks for the quick response. Yes, I’ve read these. I’m comfortable with using vault in the ways described in the docs. My question is more about accessing variables from vault via the python API within a dynamic inventory.

Ah, I misread you. I thought you maybe wanted to set per host variables based on logic in the dynamic inventory script.

Sorry for the confusion,
Paul