I am trying to get two variables in my vars_prompt, for username and
password.
My playbook currently looks like this:
---
- hosts: localhost
vars_prompt:
- name: "user_name"
prompt: "Enter username to be added to systems"
private: no
- name: "password"
prompt: "Enter password for new user account {{ user_name }}"
private: yes
encrypt: "sha256_crypt"
confirm: yes
tasks:
- name: Create new user on localhost
become: true
user:
name: "{{ user_name }}"
group: ansible
shell: /bin/bash
password: "{{ password }}"
When I run the playbook from my system, I receive the following error:
ERROR! 'user_name' is undefined
I do not receive an error when I signify extra variable from the command
line as so:
ansible-playbook ./testing/encrypted_passwords.yml -e "user_name=test2"
I see in the Ansible documentation that you are able to do two variables
within the
vars_prompt,
https://docs.ansible.com/ansible/latest/user_guide/playbooks_prompts.html
Any help would be appreciated, thank you!
--
You received this message because you are subscribed to the Google Groups
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.