`ERROR! Decryption failed (no vault secrets were found that could decrypt) on inventories/prod/group_vars/all/vault.yml`
BeginnerTroubleshootingVault, Performance and Execution Behaviour
Answer
Likely causes → A password was supplied but it is the wrong one, for example the staging password used for a prod file. Another cause is a password file with a trailing newline or extra characters. Ansible strips one trailing newline, but not \r\n from Windows editors.
Diagnose →
head -1 inventories/prod/group_vars/all/vault.yml # $ANSIBLE_VAULT;1.2;AES256;prod
ansible-vault view --vault-id prod@prompt inventories/prod/group_vars/all/vault.yml
od -c ~/.secrets/prod.pass | tail -2 # look for \r
Fix → Use the correct password for that environment, and remove the stray \r with dos2unix.
Prevent → Use one vault ID per environment, with IDs that match the inventory directories.
More on Vault, Performance and Execution Behaviour
`ERROR! Attempting to decrypt but no vault secrets found`BeginnerBoth `--vault-id [email protected]` and `--vault-id prod@prompt` are passed, and prod files still fail to decryptIntermediate`Vault format unhexlify error: Odd-length string` after pasting an `encrypt_string` valueIntermediate`Problem running vault password script /home/ci/.vault_pass ([Errno 8] Exec format error). If this is not a script, remove the executable bit from the file.`AdvancedEvery change to `vault.yml` produces an unreadable diff and constant merge conflictsIntermediateVaulted variables are undefined, although the file decrypts fine with `ansible-vault view`Beginner