Quiz Entry - updated: 2026.10.30
How do you find out which configuration file Ansible is actually using?
Run ansible --version (it prints a config file = line) or add -v to a command, which prints "Using ... as config file".
$ ansible --version
ansible 2.9.21
config file = /etc/ansible/ansible.cfg
...
$ ansible servers --list-hosts -v
Using /etc/ansible/ansible.cfg as config file
...
Because four different places can hold an ansible.cfg, and only the first one found counts, "which file am I using?" is a real question. The output above says no project or personal file was found, so the global file is in effect, which explains why a carefully edited ~/ansible/project/ansible.cfg seems to be ignored when you run the command from your home directory.
ansible --version also tells you the installed Ansible version and Python interpreter, which are the next things to check when behaviour differs between machines.
Go deeper:
ansible command reference (official docs) —
--versionand the verbosity flags.Configuring Ansible (official docs) — generating a sample
ansible.cfgand listing current settings withansible-config.