Serge,
> <mailto:
hans....@ofd-z.niedersachsen.de>> wrote:
>
> # test:
> [*webserver-tes*t]
> foo1
> server2
>
> # production
> [webservers-prod]
> foo2
> server1
>
> How can I check in the task and in jinja templates, if the host is
> in test or production?
>
> I asked something related in 2013 and got
>
> "when: inventory_hostname in groups.webserve*rs*-test" as an answer.
> But this results in a fatal
> "error while evaluating conditional: inventory_hostname in
> groups.webservers-test"
>
>
> You inventory has webserver-test, not webserver*s*-test :)
this have not been real world names, as you can imagine. :)
It war an error in the mail, of course.
> But next thing would be, variable names cannot have dashes, so you would
> need to rewrite you conditional using a string:
>
> when: inventory_hostname in groups["webservers-test"]
OK, thank you.
I like the [all:vars] way better now, I think.
Marc