I suggest doing this: mkdir /etc/ansible/inventory # copy POC_ENV.yml, avaya.yml, nexus.yml to /etc/ansible/inventory changing your ansible.cfg so that it looks for inventory in
/etc/ansible/inventory IIRC that will load all the inventory files in that directory I have not tried this using .yaml format inventory file but it works fine using ini format so I suspect it will work ok using .yaml format inventory. If you run ansible-playbook -vvvvvv a_test_playbook.yml the first few lines will show you where it is looking for inventory and what plugins it is using to parse and load your inventory. Hope this helps, Jon On Tuesday, December 31, 2019 at 10:13:25 AM UTC, Yehuda Pinhas wrote: > > Hi J Hawkesworth, > Can you explain exactly in which file do I need to add what code? > > Considering I have the inventories POC_ENV.yml, avaya.yml, nexus.yml for > example. What file do I need to edit? the ansible.cfg and the inventory > file? can you provide the exact solution? > > currently my ansible.cfg file directs to /etc/ansible/inventory.yml > > and my inventory.yml is empty (which is the master inventory as i > understand and from it I am supposed to direct ansible to each one of the > inventories mentioned above such as POC_ENV.yml,etc.) > > > > > > J Hawkesworth: >> >> I suggest using a directory that contains the files you need to build up >> your inventory. You can also use symlinks I think >> This is described in the documentation in the section starting '*Aggregating >> inventory sources with a directory' *here: >> >> https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#using-multiple-inventory-sources >> >> I think this might be a simpler way to achieve what you want rather than >> using add_host and including lots of inventory files directly into your >> playbook. >> >> It does depend on not having hostnames that clash of course. >> >> Hope this helps, >> >> Jon >> >>> >>> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/33f9e172-046a-41b1-89e3-a2e3c1c0d9f5%40googlegroups.com.
