Member-only story
Disable user account — Ansible module user
How to disable an “example” user in Linux by locking the password and setting the special “nologin” shell without login possibility.
How to disable a user account with Ansible?
I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.
Ansible disable user account
Today we’re talking about the Ansible module `user`.
The full name is `ansible.builtin.user`, which means that is part of the collection of modules “builtin” with ansible and shipped with it.
It’s a module pretty stable and out for years, it manages user accounts.
It supports a huge variety of Linux distributions, SunOS and macOS, and FreeBSD.
For Windows, use the `ansible.windows.win_user` module instead.
Parameters
- name string — username
- state string — present/absent
- password_lock boolean — no/yes