ansible/roles/ubuntu_base/tasks/users.yml
Reynir Björnsson 5d745e0cde Allow for multiple ssh keys
This required restructuring users.yml.
2022-01-28 13:15:14 +00:00

26 lines
568 B
YAML

---
- name: "Add users"
user:
name: "{{ item.name }}"
comment: "{{ item.comment }}"
password: "{{ item.password }}"
update_password: "on_create"
groups: "{{ item.groups }}"
loop: "{{ users | default([]) }}"
- name: "Add ssh authorized_keys"
authorized_key:
user: "{{ item.0.name }}"
key: "{{ item.1 }}"
with_subelements:
- "{{ users | default([]) }}"
- keys
- name: "Add ssh authorized_keys to root user"
authorized_key:
user: "root"
key: "{{ item.1 }}"
with_subelements:
- "{{ users | default([]) }}"
- keys