
How it works...
By default, Ansible's settings are controlled by the ansible.cfg file located in the /etc/ansible directory. This is the default configuration file for Ansible that controls how Ansible interacts with managed nodes. We can edit this file directly. However, this will impact any playbook that we will use on the Ansible control machine, as well as any user on this machine. A more flexible and customized option is to include a file named ansible.cfg in the project directory and this includes all the options that you need to modify from their default parameters. In the preceding example, we outline only a small subset of these options, as shown here:
- inventory: This option modifies the default inventory file that Ansible searches in order to find its inventory (by default, this is /etc/ansible/hosts). We adjust this option in order to let Ansible use our inventory file and stop using the -i operator to specify our inventory during each playbook run.
vault_password_file: This option sets the file that has the secret password for encrypting and decrypting ansible-vault secrets. This option removes the need to run Ansible playbooks with the --vault-id operator when using ansible-vault-encrypted variables.
gathering = explicit: By default, Ansible runs a setup module to gather facts regarding the managed nodes while the playbook is running. This setup module is not compatible with network nodes since this module requires a Python interpreter on the managed nodes. By setting fact gathering to explicit, we disable this default behavior.