From 0467496724b8875a5ba5fa95d07740aa51f6c780 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 8 Nov 2020 09:32:29 +0200 Subject: feat(unix_users): allow a user to be added to extra groups --- roles/unix_users/tasks/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'roles/unix_users/tasks/main.yml') diff --git a/roles/unix_users/tasks/main.yml b/roles/unix_users/tasks/main.yml index cd6fb66..e181054 100644 --- a/roles/unix_users/tasks/main.yml +++ b/roles/unix_users/tasks/main.yml @@ -1,6 +1,6 @@ - name: "check unix_users_version" shell: | - [ "{{ unix_users_version }}" = "1" ] || \ + [ "{{ unix_users_version }}" = "2" ] || \ (echo "Unexpected version {{ unix_users_version }}" 1>&2; exit 1) - name: create system users @@ -10,6 +10,13 @@ comment: "{{ item.comment|default('unnamed user') }}" shell: "{{ item.shell|default('/bin/bash') }}" system: "{{ item.system|default('no') }}" + +- name: add users to additional groups + with_items: "{{ unix_users }}" + when: item.groups is defined + user: + name: "{{ item.username }}" + groups: "{{ item.groups }}" - name: set password for users with_items: "{{ unix_users }}" -- cgit v1.2.1