Reputation: 75
I'm trying to know how we can specify the inventory file path in the ansible playbook. I'm aware of specifying the inventory path at the command line using "-i" and it works for me. But i'm looking at providing the inventory file path and the group within the ansible palybook.
Can anyone help me on this. Thank you
Upvotes: 5
Views: 11399
Reputation: 1784
okay. you don't specify inventory file path in Ansible playbook. However, you do specify it in your ansible.cfg file.
How do you specify the inventory file in the configuration file (i.e ansible.cfg
), simply open it and have
inventory = /path/to/your/inv/file
if you ask where to put the ansible.cfg file
you could create a .ansible.cfg
in your home directory and have this info [note the .
infront of the file name]
OR
you could create a ansible.cfg
in your current working directory and have this info.[note NO DOT
infront of the file name]
OR you can simply edit /etc/ansible/ansible.cfg
file and have this info.
OR
you can pass this configuration file path information in a environment variable ANSIBLE_CONFIG
Upvotes: 5