I am trying to disable a user and not remove it completely
I typically do something like:
-
name: Disable the ubuntu user
user:
name: ubuntu
password: “!”
shell: /usr/sbin/nologin -
name: Remove the ubuntu users ssh key
file:
path: /home/ubuntu/.ssh/authorized_keys
force: yes
state: absent
Or you can just expire the user :
- user:
name: thatguy
expires: "{{lookup('pipe', 'date +%s')}}"
Thanks It works!
Thanks. It works