Ansible Configure Default Inventory File
By default, Ansible would attempt to read the default configuration file at /etc/ansible/hosts
, we can specify the default configuration file to use by creating an Ansible configuration file.
Procedure
- Create
ansible.cfg
file in home directory, or project directory. - Configure the
ansible.cfg
file in home directory, & add[defaults]
section:
[defaults]
inventory = ~/.ansible/hosts
Source: StackOverFlow
Reference(s):