On Thursday, 11 January 2018 18.59.27 CET Chris Barlock wrote:
> I have the following in one of my playbooks:
> 
> - name: "Copy SSH keys"
>   command: sshpass -f ~/temp.pass ssh-copy-id -i ~/.ssh/id_rsa.pub {{ 
> ansible_user }}@{{ item }}
>   with_flattened: 
>     - groups.worker 
>     - groups.proxy 
>   when: item not in groups.master
> 

<snip />

> 
> As you can see, groups.workers and groups.proxy are taken as literal 
> strings and are the IP addresses are not substituted.  Should I be doing 
> this another way?

Yes, if you want to use variables you need to enclose them in {{ }}
    - '{{ groups.worker }}'
    - '{{ groups.proxy }}'


-- 
Kai Stian Olstad

-- 
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/1844355.ejFI7x52LI%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to