From the course: Ansible for Automation Essential Training: Advanced Playbooks, Roles, and Diverse Hosts
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Using Ansible vault and vaulted files in playbooks - Ansible Tutorial
From the course: Ansible for Automation Essential Training: Advanced Playbooks, Roles, and Diverse Hosts
Using Ansible vault and vaulted files in playbooks
- [Instructor] There are several vaulting options available, but I'm really just going to concentrate on the most common uses. I've got my secrets.yml file here. I've got a variable named super_secret with the value of Greg. I'm going to encrypt it with ansible-vault encrypt secrets.yml. I'll make the password test, verify it with test, and as you can see, it went from plain text to encrypted. Now, I can also completely decrypt the file for updating if I throw the decrypt option at it. So let me change encrypt to decrypt and type my password and it's plain text again. The file's easily editable now. I'll change the value to GregSowell, save it, and then I'll re-encrypt it. Test test. Here's my demo playbook, vault.yml. It's a simple playbook with a single task that prints out the contents of super_secret variable. Pay particular attention to the vars file section. If you recall from the variables chapter, this is a simple way to pull in a file full of variables, and here I'm…