Member-only story

How to Change a User Password with Ansible

How to write an Ansible Playbook to assign the password ”password” to an ”example” user account in a Linux system with SHA512 encryption.

Luca Berton
5 min readNov 22, 2023

Introduction

Welcome to another episode of Ansible Pilot! I’m Luca Berton, and in today’s session, we’ll explore how to change a user password using Ansible. The Ansible module we’ll be focusing on is ansible.builtin.user, a stable and well-established module that comes bundled with Ansible. It's designed to manage user accounts on various Linux distributions, SunOS, macOS, and FreeBSD.

Understanding the Ansible user Module

The ansible.builtin.user module falls under the "builtin" collection of Ansible modules, indicating its integral nature within the Ansible framework. This module has been around for years and proves reliable in handling user accounts across a wide range of operating systems. For Windows environments, the equivalent module is ansible.windows.win_user.

Key Parameters

The user module offers a plethora of parameters to cater to various user management tasks. Here are…

--

--

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