Member-only story

Add a User to a Second Group on Linux — Ansible module user

How to automate the adding of a user “example” to a system or user-defined groups list on a target the Linux with few lines of Ansible playbook code.

Luca Berton
4 min readDec 14, 2021

How to add a user to a second group on Linux 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 adds a user to second a group

  • `ansible.builtin.user`
  • Manage user accounts

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

--

--

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