vn-ansible/create_user_ssh/main.yml

20 lines
535 B
YAML

- name: Create New User
hosts: "{{'hostname'}}"
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