Hi Brian,

thanks for the fast answer.

Am 06.03.16 schrieb Brian Coca:
> you made the default dict, it should be a list
> 
>   with_items: "{{ ssh_users|default([]) }}"
> 
> ssh_users is already a list so no problem there.

Sorry, but I'm not sure I understand what you mean. Do you mean that
my ssh_users is a list and not a dict? Dict being somewhere along the
lines of:

ssh_users
  - user1: foo
  - user2: bar

Using 'default{()}' returns a dict, not a list, is that what you meant?

> On Sun, Mar 6, 2016 at 8:23 AM, Johannes Kastl <[email protected]> wrote:

>> The role main.yml contains:
>> #################
>> - name: This runs if ssh_users is not set
>>   copy:
>>     src='{{ ansible_hostname }}'
>>     dest='/some/path/'
>>   when: not ssh_users

>> The first part is skipped if ssh_users is set, but returns an error if
>> it is not set. I think I might be able to use default here somehow,
>> but haven't figured out how. Using quoted variables does not help either.

How to run this task is ssh_users is not defined in the hostvars?

when: "{{ ssh_users|default([X]) }} == X"

Thanks!

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/56DC6F3D.3030807%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to