On 25.02.2019 17:36, Venkata Vuppala wrote:
> Thanks for the with_items variable, but can this looping system be used to
> scan for hosts deep inside the inventory file rather than groups (a child
> group? )
nsible inventory kind of a flat structure, groups and hosts.
> admin-1/2 are hosts here. I am using Ansible 2.4
>
> Eg:
>
> [admin:children]
> admin-1
> admin-2
This means that group admin-1 and group admin-2 is member of group admin.
So if admin-1 and 2 are host this should be
[admin]
admin-1
admin-2
> I did try with the below syntax, but it didn't work. I think Ansible didn't
> like it either.
>
> - -A INPUT -s "{{ hostvars[ my_platform + my_server + [item]]['ansible_ssh_host'] }}" -j ACCEPT
This Jinja template is not valid, I'm not sure what you are trying to do.
> with_items: groups['admin:children']
this would be
with_items: groups['admin']
--
Kai Stian Olstad