EvoBSD/roles/accounts/tasks/user.yml

48 lines
1.0 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: "Group '{{ user.name }}' is present"
group:
state: present
name: "{{ user.name }}"
gid: "{{ user.uid }}"
- name: "User '{{ user.name }}' is present"
user:
state: present
name: '{{ user.name }}'
uid: '{{ user.uid }}'
password: '{{ user.password_hash_openbsd }}'
group: "{{ user.name }}"
groups: wheel
shell: /bin/ksh
append: true
tags:
- admin
- name: "Home directory for '{{ user.name }}' is only accesible by owner"
file:
name: '/home/{{ user.name }}'
mode: "0700"
owner: "{{ user.name }}"
group: "{{ user.name }}"
state: directory
- name: "SSH public keys for '{{ user.name }}' are present"
authorized_key:
user: "{{ user.name }}"
key: "{{ ssk_key }}"
state: present
with_items: "{{ user.ssh_keys }}"
loop_control:
loop_var: ssk_key
when: user.ssh_keys is defined
tags:
- admin
- name: "Add {{ user.name }} to {{ evobsd_group }} group"
user:
name: "{{ user.name }}"
groups: "{{ evobsd_group }}"
append: true
tags:
- admin