Brian Coca
unread,Jul 15, 2015, 10:10:59 AM7/15/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
when gets evaluated INSIDE the with loop, so it cannot condition the
executing of with, this is done so you can do when: item == 'blah' for
example to condition each iteration in the loop.
to deal with undeinfed with_ vars, do the following:
with_ : "{{ myvar|default([])}}"
^ the empty [] will skip the task as there is nothing to loop over.
some times you need more complex conditions, ternary filter can help:
with_ : "{{ unexisting is defined|ternary( groups['unexisting'], []) }}"
--
Brian Coca