ansible-vault(1)
πΈ ansible-vault β the encryption/decryption utility for Ansible data files π
okay bestie, so this is ansible-vault, one of the system administration commands, and honestly it's the glow-up your secret data deserves. It does encryption and decryption for all your Ansible data files. Let's get into it β¨
β¨ SYNOPSIS β¨
usage: ansible-vault [-h] [--version] [-v]
{create,decrypt,edit,view,encrypt,encrypt_string,rekey} ...
π¦ DESCRIPTION π¦
So here's the tea: it can encrypt any structured data file used by Ansible. That includes your group_vars/ or host_vars/ inventory variables, variables loaded by include_vars or vars_files, or variable files passed on the ansible-playbook command line with -e @file.yml or -e @file.json. Role variables and defaults are also included! π
And because Ansible tasks, handlers, and other objects are data, these can also be encrypted with vault. If you'd like to not expose what variables you're using, you can keep an individual task file entirely encrypted. Iconic behavior, no cap. π₯
π COMMON OPTIONS π
--versionβ show program's version number, config file location, configured module search path, module location, executable location and exit-h,--helpβ show this help message and exit-v,--verboseβ Causes Ansible to print more debug messages. Adding multiple-vwill increase the verbosity, the builtin plugins currently evaluate up to-vvvvvv. A reasonable level to start is-vvv, connection debugging might require-vvvv. This argument may be specified multiple times.
π ACTIONS π
π create
create and open a file in an editor that will be encrypted with the provided vault secret when closed β¨
--encrypt-vault-id'ENCRYPT_VAULT_ID' β the vault id used to encrypt (required if more than one vault-id is provided)--skip-tty-checkβ allows editor to be opened when no tty attached--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password
πΈ decrypt
decrypt the supplied file using the provided vault secret π«Ά
--output'OUTPUT_FILE' β output file name for encrypt or decrypt; use-for stdout--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password
π¦ edit
open and decrypt an existing vaulted file in an editor, that will be encrypted again when closed β like a little secret makeover π
--encrypt-vault-id'ENCRYPT_VAULT_ID' β the vault id used to encrypt (required if more than one vault-id is provided)--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password
β view
open, decrypt and view an existing vaulted file using a pager using the supplied vault secret π
--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password
π₯ encrypt
encrypt the supplied file using the provided vault secret π
--encrypt-vault-id'ENCRYPT_VAULT_ID' β the vault id used to encrypt (required if more than one vault-id is provided)--output'OUTPUT_FILE' β output file name for encrypt or decrypt; use-for stdout--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password
π encrypt_string
encrypt the supplied string using the provided vault secret β¨
--encrypt-vault-id'ENCRYPT_VAULT_ID' β the vault id used to encrypt (required if more than one vault-id is provided)--output'OUTPUT_FILE' β output file name for encrypt or decrypt; use-for stdout--show-inputβ Do not hide input when prompted for the string to encrypt--stdin-name'ENCRYPT_STRING_STDIN_NAME' β Specify the variable name for stdin--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password-n,--nameβ Specify the variable name. This argument may be specified multiple times.-p,--promptβ Prompt for the string to encrypt
π§ rekey
re-encrypt a vaulted file with a new secret, the previous secret is required π
--encrypt-vault-id'ENCRYPT_VAULT_ID' β the vault id used to encrypt (required if more than one vault-id is provided)--new-vault-id'NEW_VAULT_ID' β the new vault identity to use for rekey--new-vault-password-file'NEW_VAULT_PASSWORD_FILE' β new vault password file for rekey--vault-idβ the vault identity to use. This argument may be specified multiple times.--vault-password-file,--vault-pass-fileβ vault password file-J,--ask-vault-password,--ask-vault-passβ ask for vault password
π ENVIRONMENT π
The following environment variables may be specified.
ANSIBLE_CONFIGβ Specify override location for the ansible config file
Many more are available for most options in ansible.cfg.
For a full list check <https://docs.ansible.com/>. or use the ansible-config command.
π FILES π
/etc/ansible/ansible.cfgβ Config file, used if present~/.ansible.cfgβ User config file, overrides the default config if present./ansible.cfgβ Local config file (in current working directory) assumed to be 'project specific' and overrides the rest if present.
As mentioned above, the ANSIBLE_CONFIG environment variable will override all others. π
π«Ά AUTHOR π«Ά
Ansible was originally written by Michael DeHaan.
π COPYRIGHT π
Copyright Β© 2018 Red Hat, Inc | Ansible. Ansible is released under the terms of the GPLv3 license.
π¦ SEE ALSO π¦
ansible(1),ansible-config(1),ansible-console(1),ansible-doc(1),ansible-galaxy(1),ansible-inventory(1),ansible-playbook(1),ansible-pull(1),
Extensive documentation is available in the documentation site: <https://docs.ansible.com>. IRC and mailing list info can be found in file CONTRIBUTING.md, available in: <https://github.com/ansible/ansible>
π and that's the whole vibe, bestie β this page isAnsible 2.22.0flavored, signedansible-vault(1), and it ate. periodt. π β¨
π¦ where this page comes from
- arch rolling: ansible-core 2.22.0-1 Β· GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms