Linux

Where Is the Ansible Config File?

Ansible config file precedence (project, home, system) and the default inventory and roles paths on Linux.

Last updated

Ansible searches for config in order: ANSIBLE_CONFIG variable, ./ansible.cfg in the project, ~/.ansible.cfg in home, then /etc/ansible/ansible.cfg. First hit wins.

Project-local config usually wins in practice, which is why global edits seem ignored. The version command prints the effective file.

Where Ansible stores this, by platform

Linux
/etc/ansible/ansible.cfg

System-wide fallback, lowest precedence. Default inventory lives next to it at /etc/ansible/hosts. Project and home configs override this.

Linux
~/.ansible.cfg

Per-user override. A project-level ./ansible.cfg still beats it. Confirm the winner with ansible --version.

Frequently asked questions

Which ansible.cfg is active?

Run ansible --version. Its first lines print the config file in use, which resolves the precedence question for your exact invocation and directory.

Notice an outdated path? Let us know.