#test hashicorp vault # if error: riginal message: Please pip install hvac to use the hashi_vault lookup module. # please find which python is used: ansible -m debug -a 'var=ansible_playbook_python' localhost # and install the hvac to the python by: pip install -t /usr/lib64/python2.7/site-packages hvac --- - hosts: 127.0.0.1 vars_files: - extra_vars/all.yml vars: qcloud_key: "{{ lookup('hashi_vault', 'secret=yoho/ops/qcloud token='+'{{vault.token}}'+' url='+'{{vault.server}}') }}" tasks: - name: Installing pip modules for using vault lookup pip: name={{item}} with_items: - hvac - hvac[parser] - debug: msg: "all info: {{ qcloud_key }}" - debug: msg: "{{qcloud_key.SecretKey}}" #Test: ansible-playbook vault-test.yml -e '@extra_vars/all.yml'