The users role allows you to create users on your target node with random passwords.
First you need to install the role on the node from which you will execute ansible via
ansible-galaxy install ckaserer.users
The playbook below creates two users, ckaserer
and jdoe
, and sets a random password for each user stored in their home directory as .password
.
- hosts: localhost
tasks:
- name: "Include ckaserer.users"
include_role:
name: "ckaserer.users"
vars:
users:
- ckaserer
- jdoe