[ansible-project] Re: Condition before lookup

2014-09-22 Thread Daniel Schroeder
OK, I found a workaround. My task actually is inside a role. Therefore I was able to define a default value for *some_dict*. myRole/defaults/main.yml: some_dict: {} The condition still is ignored, but with no elements nothing is processed, obviously. Is there another solution to this? If

Re: [ansible-project] Re: Condition before lookup

2014-09-22 Thread Brian Coca
conditionals are for tasks, not for lookups, these always get executed -- 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

[ansible-project] Re: Condition before lookup

2014-09-22 Thread Daniel Schroeder
Not really a solution for the problem, is it? ;) Am Montag, 22. September 2014 12:44:54 UTC+2 schrieb Daniel Schroeder: Hello list, I'm having a problem with adding a condition before a lookup plugin. A simplified example that everyone can reproduce is this: - debug: msg=This debug

Re: [ansible-project] Re: Condition before lookup

2014-09-22 Thread Brian Coca
actually the solution is what you already used or with_dict: some_dict|default({}) -- 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

[ansible-project] Re: Condition before lookup

2014-09-22 Thread Daniel Schroeder
Ah, great, didn't know you can use *default* in the yml itself. Only had been using it in jinja templates. Thanks, that works and is more elegant that creating the additional defaults file. -- You received this message because you are subscribed to the Google Groups Ansible Project group. To

Re: [ansible-project] Re: Condition before lookup

2014-09-22 Thread Brian Coca
with_ fields are 'auto templated', you can use jinja2 in all fields that are so -- 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

Re: [ansible-project] Re: Condition before lookup

2014-09-22 Thread Michael DeHaan
For some further elucidation, it should be pointed out that the when gets evaluated for every step of the loop, which is why it can't be applied to decide whether to loop in the first place. when: foo is defined and insert conditional here on the loop item with_items: foo Will work as a looping