Thank you! That worked. Tricker syntax because you need the braces in the
with_flattened element, but not in the when element.
Chris
On Friday, January 12, 2018 at 10:32:27 AM UTC-5, Kai Stian Olstad wrote:
>
> 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/d40576d1-dde7-460f-9251-baaac096c6a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.