From the course: Ansible Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Using secrets in plays

Using secrets in plays

- [Instructor] Well, in the previous video, we took a look at Ansible Vault for encrypting entire files. And this is a great approach. And oftentimes, we want to use this, but what if we want to be more granular? What if we don't want our entire YAML playbook to be encrypted? What if we just want to utilize encryption on sensitive strings? Well, Ansible thought of everything. We have with the Ansible Vault now the ability to say encrypt_string. Now, I want to be prompted for a password here. So for a vault ID, I'm going to say @prompt. And then we'll go ahead and provide the string that we want encrypted. So for example, this is my super secret string. So when I hit enter, it's going to ask us for a vault password. So I go ahead and give a vault password for this string encryption. And then notice what it does. It presents to us the syntax that we need for inside of our playbook. Oh, this is great! So now, we have…

Contents