Feat: add group creation for user

This commit is contained in:
Bertrand Benjamin 2022-05-18 11:22:18 +02:00
parent faedd20757
commit e95e6063f7

View File

@ -7,8 +7,10 @@
# Create user # Create user
- name: Ensure wheel group exists - name: Ensure wheel group exists
group: group:
name: wheel name: "{{ item }}"
state: present state: present
with_items: "{{ user.groups | replace(' ', '') | split(',') }}"
- name: "{{ username }} -- create user " - name: "{{ username }} -- create user "
ansible.builtin.user: ansible.builtin.user:
@ -22,15 +24,13 @@
system: "{{ user.system | default('no') }}" system: "{{ user.system | default('no') }}"
create_home: true create_home: true
#
- name: "{{ username }} -- Add public key" - name: "{{ username }} -- Add public key"
authorized_key: authorized_key:
user: "{{ user.username }}" user: "{{ user.username }}"
key: "{{ lookup('file', item.keyfile) }}" key: "{{ lookup('file', item.keyfile) }}"
state: present state: present
with_items: "{{ user.public_key | default([]) }}" with_items: "{{ user.public_key | default([]) }}"
# Dotfiles
- name: "{{ username }} -- set dotfiles" - name: "{{ username }} -- set dotfiles"
import_tasks: dotfiles.yml import_tasks: dotfiles.yml