We have seen so far 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 with the installation of a MySQL server on the database server.
Let's begin by looking at the use and utility of variables in Ansible.