add system user task

This commit is contained in:
vincent 2021-02-24 22:40:34 +01:00
parent 6093328fa6
commit f7ccb079a0
3 changed files with 24 additions and 1 deletions

View File

@ -84,4 +84,10 @@ system_base_softwares_debian:
system_upgrade: false
system_arch_local_mirror:
system_user: []
#- name: toto
#home: /home/toto
#shell: '/bin/zsh'
#group: ezfef
system_group: []
keystodeploy: []

View File

@ -3,6 +3,7 @@
- include_tasks: hostname.yml
- include_tasks: locales.yml
- include_tasks: time.yml
- include_tasks: usergroup.yml
- include_tasks: pacman.yml
when: ansible_facts['os_family'] == "Archlinux"
- include_tasks: depot_debian.yml

16
tasks/usergroup.yml Normal file
View File

@ -0,0 +1,16 @@
---
- name: create system user
become: yes
user:
name: "{{item.name}}"
system: yes
home: "{{ item.home | default('/') }}"
shell: "{{ item.shell |default('/usr/bin/nologin') }}"
with_items: "{{system_user}}"
- name: create system group
group:
name: "{{item.name}}"
with_items: "{{system_group}}"
become: yes