Skip to content
Snippets Groups Projects
Commit 66fe3665 authored by jurgenhaas's avatar jurgenhaas
Browse files

New playbook to lock a user completely

parent ea7a21db
Branches
Tags
No related merge requests found
##
# Ansible playbook to lock a user on all hosts
#
# NOTE: the user needs to be removed from the admin list as well, otherwise
# it gets created again during system maintenance.
---
# file: userlock.yml
- name: "Lock user on all hosts"
hosts: "all"
sudo: yes
tasks:
- name: "Reset Passwd"
shell: usermod -L {{ lockuser_username }}
- name: "Remove Key"
authorized_key:
user={{ lockuser_username }}
key="{{ lookup('file', inventory_dir + '/files/keys/' + lockuser_username + '.d2s.pub') }}"
state=absent
exclusive=yes
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment