I hava an inventory file in INI format:
for example:
[db]
8.8.8.8 ansible_user=root ansible_ssh_private_key_file=/keys/root-id_rsa.pem
....
I'm looking for a way to automatically load my inventory file while running without specify which inventory file path when I triggered my ansible-playbook command
ansible-playbook playbook.yml --inventory-file=hosts (I'm trying to avoid from this) -vv
I'm familiar with the "add_host" module but still I prefer to create an inventory file in INI format and somehow to let the playbook load it automatically. is that possible?
Edit:
Thanks to the users @techraf and @Jeff Hemmen I added more details to question
In addition, I don't want to use either the ansible.cfg file because I want to perform this inside the playbook.yml file itself and not from outside
something like:
- name: add_host {{environment_type}} db servers
hosts: localhost
vars_files:
- vars/main.yml
roles:
- { role: my_role}
inventory_file: (possible?)
- inventory/hosts.ini (possible?)