[ansible-project] Re: Multiple and/or conditions in when wont work

2017-07-02 Thread Daniel JD
The jinja2 template, does work in the when clause. In fact, you dont even need the curly brakets. My example gave you an error because i missed the quotes around the items. The items arent variables, these are strings. So you cant get an "is not defined" with that code! The following code ski

[ansible-project] Re: Multiple and/or conditions in when wont work

2017-06-30 Thread ajay jiwanand
This doesn't work as if I put the second value (in this case kernel) it tries to check it throws an error saying security is undefined. I found that jinja2 templates dont seem to work in the when clause. I tried many jinja2 templates that should work in regular situations but they failed (e.g w

Re: [ansible-project] Re: Multiple and/or conditions in when wont work

2017-06-30 Thread ajay jiwanand
My bad I was working with many different solutions and combinations so I got confused. I tried tons of complicated ways .. can't believe such a simple one worked lol. I probably over complicated it but what you suggested works great! when: not (security is defined or kernel is defined or spec

[ansible-project] Re: Multiple and/or conditions in when wont work

2017-06-30 Thread Daniel JD
You could use the intersect filter from jinja2. I am thinking about sth. like the following: when: ansible_os_family == "RedHat" and not vars.keys() | intersect([security,kernel,specified_packages]) Am Donnerstag, 29. Juni 2017 23:34:16 UTC+2 schrieb ajay jiwanand: > > I am having issues with u

Re: [ansible-project] Re: Multiple and/or conditions in when wont work

2017-06-30 Thread Kai Stian Olstad
On 30. juni 2017 19:10, ajay jiwanand wrote: Im posting my stack overflow question as it is much more clear: Ask Question up vote0down votefavorite

[ansible-project] Re: Multiple and/or conditions in when wont work

2017-06-30 Thread ajay jiwanand
Im posting my stack overflow question as it is much more clear: Ask Question up vote0down votefavorite I am having issues when tryi