top of page
Writer's pictureSiddhesh Kadam

Ansible Configuration File Priority (Precedence)

In Ansible, configuration files have a specific priority order, which determines which configuration settings take precedence when multiple configuration files are present.

​P0

​Environment Variables

​$ANSIBLE_CONFIG

​P1

Current Directory

​ansible.cfg

P2

​User's Home Directory

​~/.ansible.cfg

P3

Default Configuration File

​/etc/ansible/ansible.cfg

(P0) Environment Variables: Ansible can be influenced by environment variables like ANSIBLE_CONFIG, which can be set to point to a specific configuration file, and these settings will take precedence over the default configuration file. (P1) Current Directory: If you have a local configuration file in your project directory (by default, named ansible.cfg), it will take precedence over global configuration files.


(P2) User's Home Directory: The user-level configuration file located at ~/.ansible.cfg can be used to define user-specific configuration options.


(P3) Default Configuration File: If no configuration settings are found in any of the above files, Ansible uses built-in defaults.

bottom of page