Use hostnames from ansible group into template

Hi!
Does anybody know solution for scenario like this:
i have template (sudoers file with host list) like this

Host_group = host1, host2, host3
Host_group = host4, host5, host6
Host_group = host7, host8, host9

And host file like this:
[app]
host1
host2
host3

[db]
host4
host5
host6

[other]
host7
host8
host9

How can i use variable with host list from hosts file? Like this:

Host_group = {{ app }}
Host_group = {{ db }}

I add some host in hosts file and it will be automatically insert into this variable. Does it real?

You mean:

Host_group = {{ groups[‘app’] | join(‘,’) }}
Host_group = {{ groups[‘db’] | join(‘,’) }}

?

W dniu wtorek, 11 marca 2014 06:21:38 UTC+1 użytkownik Petr Sukharev napisał:

Exactly! Thanks for you help.