>
>
>
> - 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.

​
  with_items: "{{ ssh_users|default([]) }}"


​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')





​^ this will skip the task due to the loop list being empty

​

----------
Brian Coca

-- 
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/CACVha7ed12CVyOvWseOsZMJn9%2Byb4uYex02U9pm1MUzDWbe%2B6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to