2023-07-25 12:29:29 +00:00
|
|
|
- name: Create New User
|
2023-07-25 12:34:26 +00:00
|
|
|
hosts: "{{'host'}}"
|
2023-07-25 12:29:29 +00:00
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
vars:
|
|
|
|
# Define your username and password here that you want to create on target hosts.
|
|
|
|
username: hola
|
|
|
|
userpass: password
|
|
|
|
supergroup: sudoers
|
|
|
|
tasks:
|
|
|
|
- name: Create User
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ username }}"
|
|
|
|
state: present
|
|
|
|
shell: /bin/bash
|
|
|
|
password: "{{ userpass | password_hash('sha512') }}"
|
|
|
|
update_password: on_create
|
|
|
|
groups: "{{ super_group }}"
|
|
|
|
append: yes
|