Let's say I have the following hosts groups in my Ansible inventory
[qrouters] devops-qr1 devops-qr2 [shards] devops-shrd1 devops-shrd2 devops-shrd3
I have to add shards to a mongodb cluster with a command similar as
I'd want to write that command in a templated file in my role (let's say
roles/mongo_sharding/templates/addShards.j2), but do not know how to iterate through the inventory file.
Please keep in mind that the number of hosts in the
[shards] group could change from time to time.