aboutsummaryrefslogblamecommitdiffstats
path: root/roles/sshd_keys/tasks/main.yml
blob: 32f6b5ad7c84b917d8954f1203926697f74b474f (plain) (tree)
1
2
3
4
5
6
7
8
9

   
                                  
                       
                     
                   
                 
                        
                
                  

                            
                               


                                                
               


                                                                          
---

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

- name: synchronize ssh keys
  ansible.posix.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.