Member-only story

Enable user account — Ansible module user

How to enable a user without password lock and with the appropriate shell in Linux.

Luca Berton
4 min readOct 4, 2021

How to Enable 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 enables user account

Today we’re talking about the Ansible module `user`.

The full name is ansible.builtin.user, which means that it is part of the collection of modules “builtin” with ansible and shipped with it.

It’s a pretty stable module that has been out for years. It manages user accounts.

It supports a huge variety of Linux distributions, SunOS and macOS, and FreeBSD.

Use the `ansible.windows.win_user` module instead for Windows.

Parameters

  • name string — username
  • state string — present/absent
  • password_lock boolean — no/yes
  • shell string — “/bin/bash”

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet