Authored by Your Name

从extra vars获取vault变量

... ... @@ -5,7 +5,7 @@
---
- hosts: 127.0.0.1
vars:
qcloud_key: "{{ lookup('hashi_vault', 'secret=yoho/ops/qcloud token=27CLyZvYcqawMn7UALUMzRbH url=http://10.66.107.2:8200') }}"
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}}
... ... @@ -16,3 +16,5 @@
msg: "all info: {{ qcloud_key }}"
- debug:
msg: "{{qcloud_key.SecretKey}}"
#Test: ansible-playbook vault-test.yml -e '@extra_vars/all.yml'
... ...