Today we're going to talk about Ansible troubleshooting, specifically about the attempt to decrypt but no vault secrets found error.
I'm Luca Berton and welcome to today's episode of Ansible Pilot
Link
- https://docs.ansible.com/ansible/latest/user_guide/vault.html
Playbook
Live Playbook of Ansible Vault in Playbook problem and fix the error:
``
Attempting to decrypt but no vault secrets found.
`
The best way of talking about Ansible troubleshooting is to jump in a live Playbook to show you practically the connection failed error and how to solve it!
Every time we would like to use Ansible Vault to store our sensitive information (passwords, access keys, configuration, etc/) encrypted, we need to specify a password for the decryption of the file.
The screen error simply reminds us that the password is incorrect or not specified.
The solution is relatively easy once you understand the underlying Ansible Vault concept.
code
- playbook_with_vault.yml
`yaml
---
- name: Playbook with Vault
hosts: all
tasks:
- name: include vault
ansible.builtin.include_vars:
file: mypassword.yml
- name: print variable
ansible.builtin.debug:
var: mypassword
`
- mypassword.yml
`bash
$ANSIBLE_VAULT;1.1;AES256
64306633373430303333623136363833633539376531666131646564633830383330353264633566
3431393662373037663037623533386463306531313435360a643062643065363638353561613738
32343439356138656363333930336636646566376533356131323830663161393533383566316138
3232356363663335610a343233626230373138626263313335623037333963336662323630363562
66396432653737333031643762353130623962323934663566336637653161386563393638333566
6434326465393363363939336433316566353265626364336265
`
error execution
`basg
$ ansible-playbook -i inventory playbook_with_vault.yml
PLAY [Playbook with Vault] **
TASK [Gathering Facts]
ok: [localhost]
TASK [include vault] **
fatal: [localhost]: FAILED! => {"ansible_facts": {}, "ansible_included_var_files": [], "changed": false, "message": "Attempting to decrypt but no vault secrets found"}
PLAY RECAP **
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
``