Protecting data with Ansible Vault
So far, we've learned how to use Ansible with an inventory file that contains the list of hosts to configure, and with a playbook that contains the code of the host's configuration actions. But in all IaC tools, it will be necessary to extract some data that is specific to a context or environment inside variables.
In this section, we will look at how to use variables in Ansible and how to protect sensitive data with Ansible Vault.
To illustrate this use and protection of variables, we will complete our example by installing a MySQL server on the database server.
Let's begin by looking at the use and utility of variables in Ansible.
Using variables in Ansible for better configuration
When deploying infrastructure with IaC, the code that's used is often composed of two parts:
- A part that describes the elements or resources that make up the infrastructure.
- Another part that differentiates the properties...