2023-07-25 12:29:29 +00:00
|
|
|
- name: Create New User
|
2023-07-25 12:33:14 +00:00
|
|
|
hosts: "{{'verdnatura_servers'}}"
|
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
|