On Mon, Apr 25, 2016 at 4:32 PM Brian Coca <[email protected]> wrote:

> don't use {{ }} in when, its already implied, you'll get weird results,
> also if present is not a var, it should be quoted, again, double
> interpolation does not work.
>
>   when: hostvars[inventory_hostname][item|basename]['user']['state'] ==
> "present"
>

When I try:

- name: deploy the ssh keys
  authorized_key:
    user: "{{ item | basename }}"
    key: "{{ lookup('file', item) }}"
  when: hostvars[inventory_hostname][item|basename]['user']['state'] ==
"present"
  with_fileglob:
    - files/*

I get:

fatal: [vmtest01]: FAILED! => {"failed": true, "msg": "The conditional
check 'hostvars[inventory_hostname][item|basename]['user']['state'] ==
\"present\"' failed. The error was: error while evaluating conditional
(hostvars[inventory_hostname][item|basename]['user']['state'] ==
\"present\"): 'dict object' has no attribute u'imntreal'\n\nThe error
appears to have been in
'/etc/ansible/roles/deploy_ssh_keys/tasks/main.yml': line 14, column 3, but
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe
offending line appears to be:\n\n\n- name: deploy the ssh keys\n  ^ here\n"}

Thanks.
-- 
Jameson

-- 
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/CAHtGYf9UvjFLEZsv5LC%3Dg3SAa2CAoKmq87vdHSX%2BEW1ifn2U1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to