aboutsummaryrefslogblamecommitdiffstats
path: root/roles/sshd/tasks/synchronize_keys.yml
blob: 722fdfa8a443249e9c2578495dae834a5324d4d9 (plain) (tree)
1
2
3
4
5
6
7
8
                                  
       
                     
                   
                 
                        
                
                  





                                                
               


                                                                          
- name: get ssh keys for all users
  find:
    paths: files/keys
    file_type: link
    recurse: true
  delegate_to: localhost
  run_once: true
  register: result

- name: synchronize ssh keys
  authorized_key:
    user: "{{ item.path | dirname | basename }}"
    state: present
    key: "{{ lookup('file', item.path) }}"
  loop_control:
    label: "{{ item.path }} -> user: {{ item.path | dirname | basename }}"
  loop: "{{ result.files }}"
  failed_when: false
remember that computers suck.