vault-test.yml
735 Bytes
#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:
qcloud_key: "{{ lookup('hashi_vault', 'secret=yoho/ops/qcloud token=27CLyZvYcqawMn7UALUMzRbH url=http://10.66.107.2:8200') }}"
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}}"