Add mandatory interactive user group

This commit is contained in:
Ryan Cavicchioni 2019-11-25 18:58:52 -06:00
parent ce85694a58
commit 134fd61d6b
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 17 additions and 0 deletions

View File

@ -1,2 +1,5 @@
---
user_default_shell: /bin/bash
user_default_groups:
- users
user_interactive_user_mandatory_groups: users

View File

@ -1,4 +1,10 @@
---
- name: create the users group
group:
name: "{{ item }}"
state: present
loop: "{{ user_default_groups }}"
- name: ensure groups
group:
name: "{{ item.name }}"
@ -25,6 +31,14 @@
when: users_interactive is defined
no_log: yes
- name: add users to default groups
user:
name: "{{ item.name }}"
groups: "{{ user_interactive_user_mandatory_groups | default(omit) }}"
append: yes
with_items: "{{ users_interactive }}"
when: users_interactive is defined and user_interactive_user_mandatory_groups is defined
- name: ensure system groups
group:
name: "{{ item.name }}"