Skip to content

Commit c2446e8

Browse files
committed
Support the append argument to the user module
When true, this argument prevents removal of an existing user from groups not listed in the groups argument.
1 parent f0ee28b commit c2446e8

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The following attributes are required for each user:
3838
- 'on_create' will only set the password for newly created users.
3939
* group - optional primary group override
4040
* groups - a list of supplementary groups for the user.
41+
* append - if yes, will only add groups, not set them to just the list in groups (optional).
4142
* profile - a string block for setting custom shell profiles
4243
* ssh_key - This should be a list of ssh keys for the user (optional). Each ssh key
4344
should be included directly and should have no newlines.

tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
group: "{{item.group | default(item.username if users_create_per_user_group else users_group)}}"
1818
# empty string removes user from all secondary groups
1919
groups: "{{item.groups | join(',') if 'groups' in item else ''}}"
20+
append: "{{item.append | default(omit)}}"
2021
shell: "{{item.shell if item.shell is defined else users_default_shell}}"
2122
password: "{{item.password if item.password is defined else '!'}}"
2223
comment: "{{item.name if item.name is defined else ''}}"

0 commit comments

Comments
 (0)