ansible/roles/ubuntu_base/tasks/users.yml

22 lines
563 B
YAML
Raw Permalink Normal View History

2018-05-08 19:09:24 +00:00
---
2018-05-08 19:31:12 +00:00
- name: "Add users"
2018-05-08 19:09:24 +00:00
user:
name: "{{ item.key }}"
comment: "{{ item.value.comment }}"
2018-05-08 19:31:12 +00:00
password: "{{ item.value.password }}"
2018-05-08 19:09:24 +00:00
update_password: "on_create"
2018-05-08 19:31:12 +00:00
groups: "{{ item.value.groups }}"
2018-05-08 19:09:24 +00:00
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({}) }}"