2021-08-25 04:33:56 +00:00
|
|
|
- name: Create user {{ item.key }}
|
|
|
|
user:
|
|
|
|
name: '{{ item.key }}'
|
|
|
|
password: '{{ item.value.default_password }}'
|
|
|
|
update_password: on_create
|
|
|
|
shell: /bin/bash
|
2021-12-17 23:17:18 +00:00
|
|
|
groups: '{{["sudo"] if users_enable_sudo else []}}'
|
2021-08-25 04:33:56 +00:00
|
|
|
|
|
|
|
- name: '{{ item.key }}: Configure ssh public keys'
|
|
|
|
authorized_key:
|
|
|
|
user: '{{ item.key }}'
|
|
|
|
key: '{{ key }}'
|
|
|
|
loop: '{{ item.value.authorized_keys }}'
|
|
|
|
loop_control:
|
|
|
|
loop_var: key
|
|
|
|
when:
|
|
|
|
item.value.authorized_keys is defined
|