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 25,300 courses taught by industry experts.
Solution: Verify the vaulted secret - Ansible Tutorial
From the course: Ansible for Automation Essential Training: Advanced Playbooks, Roles, and Diverse Hosts
Solution: Verify the vaulted secret
(upbeat music plays) - [Instructor] I started by creating the my_secret.yml file, and I'll add the variable dash dash dash lunch. And today, I had tacos. I'll now vault it: cd files/ ansible-vault encrypt my_secret. Password is just going to be test. I'll confirm it with test. Now for the playbook. I'll start with my default play info here. Now I'll include my vault file by adding a VARs file section: vars_files. And under that, I will add my - files/my_secret.yml file. I'll add a single task, so I'll add the tasks header, and then I will give the task a name. Display the lunch variable. And now for the module ansible.builtin.debug: and I'll just use the VAR option: var: lunch. I'll save that. Time for a launch, ansible-playbook-i inventory, and the playbook name is challenge3.yml--ask-vault-pass. And the vaulted password was test. Excellent. Done and done.