Where Is the Ansible Config File?
Ansible's four level ansible.cfg search order, default inventory, and state directories.
Last updated
Ansible reads exactly one config file per run, chosen by a fixed order: ANSIBLE_CONFIG beats project ansible.cfg, which beats ~/.ansible.cfg, which beats /etc/ansible/ansible.cfg. Everything else found is ignored.
Package installs ship the system file, pip installs do not. Run ansible --version to see which file your shell actually picked before debugging behavior that looks insane.
Where Ansible stores this, by platform
/etc/ansible/ansible.cfg
System default with inventory at /etc/ansible/hosts. Per user state under ~/.ansible. Generate a starter with ansible-config init --disabled. Never let a world writable project dir supply the file.
Frequently asked questions
Which ansible.cfg is actually active?
Run ansible --version. Its config file line names the winner. Environment variable first, then project dir, home, then system.
Where does Ansible keep per user state?
Under ~/.ansible, overridable with ANSIBLE_HOME. Collections, cache and temporary control sockets accumulate there across runs.
Notice an outdated path? Let us know.