Ansible Vault Encryptor
Encrypt secrets as Ansible Vault text with a vault password right in your browser, ready to paste into playbooks and variable files.
Input
Output
Guide
What is Ansible Vault?
Ansible Vault is the part of Ansible, the automation tool, that encrypts secrets such as passwords and API tokens. Encrypted secrets can sit in a Git repository next to your playbooks and roles, and Ansible decrypts them with the vault password when a playbook runs. Vault text starts with a header line, such as $ANSIBLE_VAULT;1.1;AES256, followed by lines of hexadecimal digits.
Tool description
Enter a password in Vault password first, then type or paste the secret into Plaintext. Encrypted vault shows the result as you type, ready to copy. It's the format the ansible-vault command writes, version 1.1 with AES-256: the keys come from your password and a random salt through PBKDF2 with SHA-256, the text is encrypted with AES-256 in CTR mode, and an HMAC-SHA256 lets Ansible notice any change. To decrypt vault text, use the Ansible Vault Decryptor, or press the swap button to turn the conversion around.
There are two ways to use the result:
- A whole file: paste the content of a variables file, such as
group_vars/all/vault.yml, and save the result in its place, asansible-vault encryptdoes. - A single value: encrypt only the value, then paste the result after
!vault |in a YAML file, indented, asansible-vault encrypt_stringdoes.
Example
The value warm-croissant-7, encrypted with the vault password fresh-bread-daily, pasted into a variables file:
bakery_db_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
33353639623066366539643764383531333431306631316236343937646130373531616138323031
6465666463393431373430393363306430326139346563650a373961353834633761616132306533
61383638376332333136643865356334663738656430306466373832646161633636373565356137
3831363635643635660a306235333965353464663162663764623034623438346236306464343437
65613033363161303239356466633632323730646132363063356561633737393830Run the playbook with --ask-vault-pass, type the same password, and Ansible uses warm-croissant-7 as bakery_db_password.
Good to know
- Each time the tool encrypts, it uses a new random salt, so the same secret and password give different vault text each time. Ansible decrypts all of them.
- For a single value, leave no line break after it: it would become part of the secret.
- The header is always
$ANSIBLE_VAULT;1.1;AES256, without a vault ID label. - Pick a strong vault password and keep it safe. Without it, nobody can decrypt the vault, Ansible included.
- Everything runs in your browser, so the password and the secret never leave your device.