LOGBOOK

HELP

Quiz Entry - updated: 2026.11.05

How do you create a new encrypted file with Ansible Vault, and which cipher does it use?

ansible-vault create filename asks for a new vault password, then opens the file in an editor (default vi, change it with export EDITOR=nano); when you save, the file is written encrypted. Current Ansible versions use AES256; files from older versions may still use 128-bit AES.

$ ansible-vault create secret.yml
New Vault password: ****
Confirm New Vault password: ****

Instead of typing the password you can point to a vault password file that contains it:

$ ansible-vault create --vault-password-file=vault-pass secret.yml

That file holds the password in plain text, so protect it with strict permissions (chmod 600) and never commit it to the same repository as the encrypted files. Otherwise the encryption protects nothing.

An encrypted file starts with a header like $ANSIBLE_VAULT;1.1;AES256, followed by hex-encoded ciphertext. That header is how Ansible recognises the file as vault-encrypted when it loads it.

Go deeper:

From Quiz: ITIA / Ansible Variables, Secrets and Facts | Updated: Nov 05, 2026