It will asks for the username and password for a new account right after you run the ansible playbook.
Ansible hosts.yaml
- hosts: hasnan1x
roles:
- common
vars_prompt:
- name: "group_account"
prompt: "Enter a new account for the group"
private: no
- name: "group_password"
prompt: "Enter a new password for the group"
private: yes
encrypt: "md5_crypt" #need to have python-passlib installed in local machine before we can use it
confirm: yes
salt_size: 7
Place this somewhere in your task in "common" roles.
- name: create new group account
user: name={{group_account}} password={{group_password}}
tags: group-pass
Test
ansible-playbook -i hosts sites.yaml -u root --ask-pass --tags group-pass