From f7ccb079a0e48f114c6859c2df486f18549385d8 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 24 Feb 2021 22:40:34 +0100 Subject: [PATCH] add system user task --- defaults/main.yml | 6 ++++++ tasks/main.yml | 3 ++- tasks/usergroup.yml | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tasks/usergroup.yml diff --git a/defaults/main.yml b/defaults/main.yml index a9b8e75..8489c20 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: [] diff --git a/tasks/main.yml b/tasks/main.yml index c904f8b..e927fa0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,10 +3,11 @@ - 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 when: ansible_facts['os_family'] == "Debian" - include_tasks: AUR_builder.yml when: ansible_facts['os_family'] == "Archlinux" -- include_tasks: base_software.yml \ No newline at end of file +- include_tasks: base_software.yml diff --git a/tasks/usergroup.yml b/tasks/usergroup.yml new file mode 100644 index 0000000..eb80491 --- /dev/null +++ b/tasks/usergroup.yml @@ -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