vn-ansible/create_user_ssh/main.yml

20 lines
535 B
YAML
Raw Normal View History

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