Issue
I installed ansible with pip into my virtualenv, but I didn't find hosts file.
I have one /etc/ansible/hosts
, but this is related to global install of ansible on the system.
Solution
You can create inventory file anywhere you like.
Just point Ansible to it via -i /path/to/inventory
parameter or setting:
[defaults]
inventory = /path/to/inventory
in your local ansible.cfg
file.
Ansible searches for config file here (in this order):
- ANSIBLE_CONFIG (an environment variable)
- ansible.cfg (in the current directory)
- .ansible.cfg (in the home directory)
- /etc/ansible/ansible.cfg
Answered By - Konstantin Suvorov Answer Checked By - Marilyn (WPSolving Volunteer)