Skip to content

Instantly share code, notes, and snippets.

@zeitounator
Created January 12, 2024 21:11
Show Gist options
  • Save zeitounator/b389d7ea779eb2d7804094f27389e38e to your computer and use it in GitHub Desktop.
Save zeitounator/b389d7ea779eb2d7804094f27389e38e to your computer and use it in GitHub Desktop.
$ cat toto.yml
$ANSIBLE_VAULT;1.1;AES256
32353335396261646339343466646261306239633333366365663862353062653632653633656162
6464663731366136633131646531303063366332633734370a653464373830666666343930393564
39393162396564356336336339666666383432323738376566626434393461376334656664396339
6461363530383238340a376333306631383762323134303931393938653837633263386664633830
61383664303562386131306234333238396434316636343230633231386138613264383566363432
6165626266626437653735383835663564313162633265643964
$ cat testtoto.py
#!/usr/bin/env python3
from ansible.constants import DEFAULT_VAULT_ID_MATCH
from ansible.parsing.vault import VaultLib, VaultSecret
vault = VaultLib([(DEFAULT_VAULT_ID_MATCH, VaultSecret('toto'.encode()))])
print(vault.decrypt(open('toto.yml').read()))
$ ./testtoto.py
b'soft:\n user: toto\n password: rototo\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment