LOGBOOK

HELP

Quiz Entry - updated: 2026.10.30

In which order does Ansible look for its configuration file, and which one wins?

ANSIBLE_CONFIG (environment variable) first, then ./ansible.cfg in the current directory, then ~/.ansible.cfg in the home directory, and only then /etc/ansible/ansible.cfg. The first file found is used.

Four configuration sources stacked in search order: ANSIBLE_CONFIG, ./ansible.cfg, ~/.ansible.cfg, /etc/ansible/ansible.cfg, then built-in defaults; the first one found is used and the rest are ignored

* Ansible walks down this list and stops at the first file it finds. *

  1. ANSIBLE_CONFIG: if this environment variable points to a file, that file overrides everything else.
  2. ./ansible.cfg: a file in the directory where you run the ansible command. This is what makes per-project settings work.
  3. ~/.ansible.cfg: the user's personal file in the home directory.
  4. /etc/ansible/ansible.cfg: the global base file shipped with the package, used only if nothing else is found.
  5. If even that is missing, Ansible uses its built-in defaults.

The more specific and more deliberate a source is, the higher it ranks: an explicit variable beats the project, the project beats the user, the user beats the system.

Tip: read it bottom-up as the order in which they were introduced (global, personal, project, variable); the search order is the reverse.

Go deeper:

From Quiz: ITIA / Ansible Inventory, Configuration and Playbooks | Updated: Oct 30, 2026