Skip to content

Commit

Permalink
Merge pull request #48 from singleplatform-eng/add_remove_and_force_o…
Browse files Browse the repository at this point in the history
…ptions_when_deleting_users

adding remove and force options for users_deleted
  • Loading branch information
Colin Hoglund authored May 30, 2017
2 parents e7960a5 + 91f7d54 commit d80c4e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,12 @@ in the system, and these will be removed on the next ansible run. The format
is the same as for users to add, but the only required field is `username`.
However, it is recommended that you also keep the `uid` field for reference so
that numeric user ids are not accidentally reused.

You can optionally choose to remove the user's home directory and mail spool with
the `remove` parameter, and force removal of files with the `force` parameter.

users_deleted:
- username: bar
uid: 1002
remove: yes
force: yes
6 changes: 5 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@
with_items: "{{users}}"

- name: Deleted user removal
user: name="{{item.username}}" state=absent
user:
name: "{{item.username}}"
state: absent
remove: "{{item.remove | default(omit)}}"
force: "{{item.force | default(omit)}}"
with_items: "{{users_deleted}}"
tags: ['users','configuration']

Expand Down

0 comments on commit d80c4e0

Please sign in to comment.