On 25.02.2019 18:08, Venkata Vuppala wrote:
> I was trying to write IPtable rules for database servers in ansible,
> wherein every time an admin server is added into the environment it should
> be allowed to ssh to the database server.
> I tried to use Matt's idea of with_items and tried to call hosts listed in
> the admin:children ( in the child group ) and unfortunately, it didn't work.
> 
> My question was that with_items can look for hosts listed in the child
> groups in the inventory?

There's nothing called a child group, that's just a syntax to say which group 
is a member in another group.
These two inventory is the same just different syntax.

inventory1:
-----------
[mysql1]
host1
host2
host3


[mysql2]
host4
host5
host6

[database:children]
mysql1
mysql2


This is the same as writing
ivertory2:
----------
[mysql1]
host1
host2
host3

[mysql2]
host4
host5
host6

[database]
host1
host2
host3
host4
host5
host6


As i wrote in previous mail, you need to use groups['admin'] and not 
groups['admin:children']


-- 
Kai Stian Olstad

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2945bf6c-a954-df53-e149-9188822e8269%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to