To rekey an Ansible vault file

Changing the key that Ansible vault uses to encrypt/decrypt a vault file is a fairly simplistic task. It simply involves using the rekey operator within the Ansible vault command-line context. In the following example, the rekey command syntax is shown:

#> ansible-vault rekey <file.yml>

Upon running the previous command, we will be prompted for the existing key and a new key. The output (if the rekey was a success) should look something like the following:

Get Implementing DevOps with Ansible 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.