怎麼用 Vault 管理敏感資料?
30. 怎麼用 Vault 管理敏感資料?
Vault 是什麼?

怎麼使用 Vault?
怎麼在 Playbooks 裡使用 Vault?
手動輸入金鑰 (密碼) 解密
透過金鑰 (密碼) 檔解密

後語
相關連結
Last updated


Last updated
$ ansible-vault create foo.yml$ ansible-vault edit foo.yml$ ansible-vault rekey foo.yml$ ansible-vault encrypt foo.yml$ ansible-vault decrypt foo.yml$ ansible-vault view foo.yml$ vi hello_world.yml
---
- name: say 'hello world'
hosts: all
vars_files:
- defaults/main.yml
tasks:
- name: echo 'hello world'
command: echo 'hello {{ world }}'
register: result
- name: print stdout
debug:
msg: "{{ result.stdout }}"
# vim: ft=ansible :
$ vi defaults/main.yml
world: 'ironman'$ ansible-vault encrypt defaults/main.yml
New Vault password:
Confirm New Vault password:
Encryption successful$ ansible-vault view defaults/main.yml
Vault password:
world: 'ironman'$ ansible-playbook hello_world.yml --ask-vault-pass$ vi ansible.cfg
[defaults]
ask_vault_pass = true$ ansible-playbook hello_world.yml$ echo 'bGpvxx' > secret.txt$ ansible-playbook hello_world.yml --vault-password-file secret.txt$ vi ansible.cfg
[defaults]
vault_password_file = secret.txt