You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 line
643B

  1. ---
  2. - name: ssh_key
  3. user:
  4. name: "{{ item }}"
  5. generate_ssh_key: yes
  6. ssh_key_type: ed25519
  7. with_items: "{{ users.keys() }}"
  8. - name: ssh directory
  9. file:
  10. path: "{{ users[item].home | default('/home/'+item) }}/.ssh"
  11. owner: "{{ item }}"
  12. group: "{{ item }}"
  13. mode: "700"
  14. state: directory
  15. with_items: "{{ users.keys() }}"
  16. - name: ssh authorized keys
  17. template:
  18. src: ssh_authorized_keys.j2
  19. dest: "{{ users[item].home | default('/home/'+item) }}/.ssh/authorized_keys"
  20. owner: "{{ item }}"
  21. group: "{{ item }}"
  22. with_items: "{{ users.keys() }}"
  23. when: users[item].ssh_authorized_keys is defined