Ansible Vault

Manage encryption with Ansible Vault.

(venv) $ ansible-vault --version

ansible-vault [core 2.12.4]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/workspace/mastering-linux.com/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /workspace/mastering-linux.com/venv/lib64/python3.10/site-packages/ansible
  ansible collection location = /workspace/mastering-linux.com/.ansible/collections:/usr/share/ansible/collections
  executable location = /workspace/mastering-linux.com/venv/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  jinja version = 3.1.1
  libyaml = True
(venv) $ ansible-vault create files/secure.yml
(venv) $ ansible-vault edit files/secure.yml
(venv) $ ansible-vault view files/secure.yml
(venv) $ ansible-vault rekey files/secure.yml
(venv) $ ansible-vault encrypt vars/variables.yml
(venv) $ ansible-vault decrypt vars/variables.yml
(venv) $ ansible-vault encrypt_string 'my secret string'
(venv) $ ansible site.yml --ask-vault-password
(venv) $ ansible site.yml --ask-vault-password --vault-password-file=vault_pass.txt