Hi Brian, Am 07.03.16 schrieb Brian Coca:
>> - name: This runs if there is something ssh_users
>> copy:
>> src='...'
>> dest='...'
>> with_items: "{{ ssh_users|default([1]) }}"
>> when: ssh_users is defined
>> ################
>>
>
> remove the when: it executes PER item, in the default you are forcing 1
> item and then skipping it.
If I leave out the 'when'-statement (and use '...|default{[]}' without
the 1), I do not get any hint in the ansible-playbook output whether
this task is skipped or not.
> ssh_users is a list:
>
> ssh_users:
> - user1: foo
> - user2: bar
>
> this is how it would be for a dict:
>
> ssh_users:
> user1: foo
> user2: bar
>
> (no -, which signifies 'list item')
OK, now I got it. Thanks!
> ^ this will skip the task due to the loop list being empty
I am not sure where this line belongs to, but I assume my example is
not totally wrong and will not break with the next release, so Im good.
Thanks, Brian!
Johannes
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/56DDD304.7020107%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
