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
--
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/9d7067f9-3fae-af7f-a0d6-440124fc09ab%40olstad.com.
For more options, visit https://groups.google.com/d/optout.