Ansible script to drop a user

We had a standard user on many Linux systems across the estate that was used for a certain purpose.

Now the project was over we needed to remove them all, the easiest way I thought was a simple ansible playbook, put all the hosts in the hosts file and leave it to run.

Below is the code should you ever need to use it, I have changed the username from the real one to protect the innocent.

---
- name: Drop THE user
  hosts: droptheuser
  user: root
  vars:

  tasks:
    - name: Drop the User
      user:
        name: username
        state: absent
        remove: yes
      tags:
        drop_user

I am always interested in feedback so please feel free to add any comments, or you can mail me  here.  If you would like to submit a quick tip  with full credit and links back to your site then also feel free to contact me.

Related Posts Plugin for WordPress, Blogger...

Escaping or ignoring a forward slash in vi

Ansible script to fix /tmp permissions