Using Ansible for Secret Management
When we automate tasks, we need to implement them with little to no user interaction. However, we also know that there will be stages where Ansible needs inputs such as usernames, passwords, API keys, and secrets. Most of these details can be kept in a variable file and passed to playbooks without a user prompt or interaction but it is not a best practice to keep this kind of sensitive information in a plain text format as variables. There are external key vault services you can use but most of them require additional setup and configurations, which you need to integrate with Ansible.
Ansible Vault is an inbuilt feature of Ansible, using which we can safeguard the sensitive parts of our Ansible artifacts by encrypting our own vault passwords. Ansible Vault is installed together with Ansible and you can use it for Ansible ad hoc commands, playbooks, or within Red Hat Ansible Automation Platform.
In this chapter, you will learn about the following...