27 lines
732 B
YAML
27 lines
732 B
YAML
---
|
|
# tasks file for users
|
|
- name: users -- Ensure wheel group exists
|
|
group:
|
|
name: wheel
|
|
state: present
|
|
|
|
- name: create users
|
|
ansible.builtin.user:
|
|
name: "{{ item.username }}"
|
|
update_password: on_create
|
|
password: "{{ item.password | password_hash('sha512')}}"
|
|
group: "{{ item.group }}"
|
|
groups: "{{ item.groups }}"
|
|
shell: "{{ item.shell | default('/bin/bash') }}"
|
|
state: present
|
|
system: "{{ item.system | default('no') }}"
|
|
createhome: "{{ item.createhome | default('no') }}"
|
|
with_items: "{{ users }}"
|
|
|
|
- name: ssh -- Add public key
|
|
authorized_key:
|
|
user: "{{ item.user.username }}"
|
|
key: "{{ lookup('file', item.key) }}"
|
|
state: present
|
|
with_items: "{{ public_key }}"
|