diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-11-08 09:32:29 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-11-08 09:44:36 +0200 |
commit | 0467496724b8875a5ba5fa95d07740aa51f6c780 (patch) | |
tree | 21a218b35165a3a6025cc56e5f4ee93d8c3706fd /roles/unix_users/tasks/main.yml | |
parent | edac7f326c8138d7377d595a3cf26f7f3d36b0fb (diff) | |
download | debian-ansible-0467496724b8875a5ba5fa95d07740aa51f6c780.tar.gz |
feat(unix_users): allow a user to be added to extra groups
Diffstat (limited to 'roles/unix_users/tasks/main.yml')
-rw-r--r-- | roles/unix_users/tasks/main.yml | 9 |
1 files changed, 8 insertions, 1 deletions
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 }}" |