Skip to content

Commit d80c4e0

Browse files
author
Colin Hoglund
authored
Merge pull request #48 from singleplatform-eng/add_remove_and_force_options_when_deleting_users
adding remove and force options for users_deleted
2 parents e7960a5 + 91f7d54 commit d80c4e0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,12 @@ in the system, and these will be removed on the next ansible run. The format
7878
is the same as for users to add, but the only required field is `username`.
7979
However, it is recommended that you also keep the `uid` field for reference so
8080
that numeric user ids are not accidentally reused.
81+
82+
You can optionally choose to remove the user's home directory and mail spool with
83+
the `remove` parameter, and force removal of files with the `force` parameter.
84+
85+
users_deleted:
86+
- username: bar
87+
uid: 1002
88+
remove: yes
89+
force: yes

tasks/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@
5050
with_items: "{{users}}"
5151

5252
- name: Deleted user removal
53-
user: name="{{item.username}}" state=absent
53+
user:
54+
name: "{{item.username}}"
55+
state: absent
56+
remove: "{{item.remove | default(omit)}}"
57+
force: "{{item.force | default(omit)}}"
5458
with_items: "{{users_deleted}}"
5559
tags: ['users','configuration']
5660

0 commit comments

Comments
 (0)