Forrest logo
back to the ansible-vault tool

ansible-vault:tldr:7a541

ansible-vault: Re-key already encrypted vault file with a new password file.
$ ansible-vault rekey --vault-password-file=${old_password_file} --new-vault-password-file=${new_password_file} ${vault_file}
try on your machine

This command is used to change the password of an encrypted file managed by Ansible Vault. Let's break down the components:

  • ansible-vault: This is the Ansible Vault command-line utility.
  • rekey: This subcommand is used to change the encryption password of the specified vault_file.
  • --vault-password-file=${old_password_file}: This option specifies the path to a file containing the current password used to encrypt the vault_file. The ${old_password_file} is a placeholder that should be replaced with the actual path to the password file.
  • --new-vault-password-file=${new_password_file}: This option specifies the path to a file containing the new password to be used for re-encrypting the vault_file with the updated password. The ${new_password_file} is a placeholder that should be replaced with the actual path to the new password file.
  • ${vault_file}: This is the path to the encrypted file managed by Ansible Vault that needs to be rekeyed. It should be replaced with the actual path to the vault_file.

Once executed, this command will re-encrypt the specified vault_file using the new password provided in ${new_password_file}, ensuring that future access to the vault_file requires the updated password.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ansible-vault tool