LOGBOOK

HELP

Quiz Entry - updated: 2026.10.30

If both ~/.ansible.cfg and ./ansible.cfg exist and each sets different keys, which settings apply?

Only those in ./ansible.cfg. Ansible does not merge configuration files: it uses settings from the first file it finds and ignores all others completely.

This surprises people who expect cascading config like CSS or Git, where a project file only overrides the keys it mentions. In Ansible, a project ansible.cfg that sets only inventory = ./inventory means that your personal remote_user from ~/.ansible.cfg is gone for commands run in that directory. Any key the winning file doesn't set falls back to Ansible's built-in default, not to the next file in the list.

Practical consequences:

  • A project's ansible.cfg should be complete for that project: everything it relies on goes into it.
  • When behaviour changes "for no reason" after you cd somewhere, check which file is active (ansible --version shows it).

Go deeper:

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