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:

  1. ANSIBLE_CONFIG: The file location specified by the value of this environment variable, if set
  2. ansible.cfg: In the current working directory
  3. ~/.ansible.cfg: In the home directory of the user
  4. /etc/ansible/ansible.cfg: The central configuration ...

Get Practical Ansible 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.