Ansible - Decrypt a property (password, private key)

About

How to decrypt a property that was previously encrypted .

Syntax

  • Inline
echo '<ansible vault string>' | tr -d ' ' | ansible-vault decrypt && echo
  • Copy the string in a file and use it as input
cat file.txt | tr -d ' ' | ansible-vault decrypt && echo

Example

echo '$ANSIBLE_VAULT;1.1;AES256
36303034313162366666366461366537393831303836316230366330343139396432343663623466
6562373361623339356430326238663963393036313539390a363836383934626138306234373739
63633563353964336235633964383238623361636664303536663031343563623064303036653931
3235393235323162340a353132343233306431316163353337393331653534653663346234333234
34613639303366383061613638323733663639316430653433393064353563303530' | tr -d ' ' | ansible-vault decrypt --vault-id playbook_vault_pass_newenv.sh && echo

Powered by ComboStrap