ansible/roles/ubuntu_base/tasks/users.yml

24 lines
584 B
YAML
Raw 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 }}"
groups: "{{ item.groups }}"
update_password: "always"
loop: "{{ users | default([]) }}"
2018-05-08 19:09:24 +00:00
- name: "Add ssh authorized_keys"
authorized_key:
user: "{{ item.name }}"
key: "{{ item.keys | join('\n') }}"
exclusive: true
loop: "{{ users | default([]) }}"
- name: "Add ssh authorized_keys to root user"
authorized_key:
user: "root"
key: "{{ item.keys | join('\n') }}"
exclusive: true
loop: "{{ users | default([]) }}"