On Mon, Apr 25, 2016 at 3:39 PM Brian Coca <[email protected]> wrote:
> not really, you probably want this:
>
> when: hostvars[inventory_hostname][item]['user']['state'] == 'present'
>
>
> in yours you are conflating 'present' which is a string with variables and
> then trying to 'double interpolate' neither of which will work.
>
Hmm... Just dropping it in didn't quite do the trick. Maybe I'd be better
off iterating through the users present on my hosts, and building the
conditional off the files that exist. Right now, this currently works with
ignore_errors instead of the conditional, but I'm hoping to get rid of it,
so I can actually monitor it for correct runs. Here's the full task:
- name: deploy the ssh keys
authorized_key:
user: "{{ item | basename }}"
key: "{{ lookup('file', item) }}"
when: "{{ item | basename }}.user.state == present"
with_fileglob:
- files/*
--
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/CAHtGYf8ziijroB5yyrePCXqbd1u9CVqViSGh3_p9VfHHZaC-AQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.