Thanks for helping with this. I would up rewriting the whole thing:

  - name: list users
    shell: ls /home | grep -v domain & ls /home/domain
    register: userlist

  - name: set users fact
    set_fact: users={{ userlist.stdout_lines }}

  - name: set files fact
    set_fact: files={{ item }}
    with_fileglob:
      - files/*
    register: files_result

  - name: set keys fact
    set_fact: keys={{ files_result.results |
map(attribute='ansible_facts.files') | list }}

  - name: deploy ssh keys
    authorized_key:
      user: "{{ item[0] }}"
      key: "{{ lookup('file',item[1]) }}"
    when: item[0] == item[1]|basename
    with_nested:
      - "{{ users }}"
      - "{{ keys }}"

-- 
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/CAHtGYf8nNuMzbRjaTw1qsdgZKS3-VrRX_qrRtWLZJWZ%3D6seV-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to