Let's say you have a playbook that uses the file module to create /tmp/foo.txt on your managed nodes.
- hosts: all
You attempt to run this playbook.
And ERROR! Attempting to decrypt but no vault secrets found is returned.
ERROR! Attempting to decrypt but no vault secrets found
This error can occur when you have a file in the group_vars directory that has been encrypted by the ansible-vault create or ansible-vault edit or ansible-vault encrypt command. For example, let's say the /usr/local/ansible/group_vars/all/foo.txt file has been encrypted.
In this scenario, it usually a good idea to first ensure the file was encrypted. If so, something like this should be returned.
~]$ cat foo.txt
Then see if you can decrypt the file using the ansible-vault view command.
ansible-vault view foo.txt
You will be prompted to for the vault password.
After providing the valid vault password, the content of the encrypted file will be displayed.
If you are able to decrypt the file, one option would be to use the --ask-vault-pass command line flag so that you are prompted for the vault password.
~]# ansible-playbook foo.yml --ask-vault-pass
ansible-playbook foo.yml --vault-password-file group_vars/all/.vault_password.txt