ansible/roles/ubuntu_base/tasks/users.yml

22 lines
563 B
YAML

---
- name: "Add users"
user:
name: "{{ item.key }}"
comment: "{{ item.value.comment }}"
password: "{{ item.value.password }}"
update_password: "on_create"
groups: "{{ item.value.groups }}"
with_dict: "{{ users | default({}) }}"
- name: "Add ssh authorized_keys"
authorized_key:
user: "{{ item.key }}"
key: "{{ item.value.key }}"
with_dict: "{{ users | default({}) }}"
- name: "Add ssh authorized_keys to root user"
authorized_key:
user: "root"
key: "{{ item.value.key }}"
with_dict: "{{ users | default({}) }}"