Exploring the configuration file
Ansible’s behavior is, in part, defined by its configuration file. The central configuration file (which impacts the behavior of Ansible for all users on the system) can be found at /etc/ansible/ansible.cfg
. However, this is not the only place Ansible will look for its configuration; in fact, it will look in the following locations, from the top to the bottom.
The first instance of the file is the configuration it will use; all of the others are ignored, even if they are present:
ANSIBLE_CONFIG
: The file location specified by the value of this environment variable, if setansible.cfg
: In the current working directory~/.ansible.cfg
: In the home directory of the user/etc/ansible/ansible.cfg
: The central configuration that we previously mentioned
If you installed Ansible through a package manager, such as dnf
, yum
, or apt
, you will almost always find a default configuration file called ansible.cfg
in /etc/ansible
...