ansible/roles/ubuntu_base/tasks/users.yml

26 lines
568 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.name }}"
comment: "{{ item.comment }}"
password: "{{ item.password }}"
2018-05-08 19:09:24 +00:00
update_password: "on_create"
groups: "{{ item.groups }}"
loop: "{{ users | default([]) }}"
2018-05-08 19:09:24 +00:00
- 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