Skip to the content.

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

  1. Create ansible.cfg file in home directory, or project directory.
  2. Configure the ansible.cfg file in home directory, & add [defaults] section:
[defaults]
inventory = ~/.ansible/hosts

Source: StackOverFlow

Reference(s):