In ansible I am trying to get user input.
First set of input asks user to make a choice from the given input where as the other prompts for username and password.
Tasks
vars_prompt:
- name: logging_endpoint_selected
prompt : " Confirm the endpoint to forward logs.\n
1. test1 \n
2. test2 \n
* Please input either 1 or 2 based on your selection "
private: no
- name: "Username"
prompt: " Splunk software must create an administrator account during startup. Otherwise, you cannot log in.\n Create credentials for the administrator account.\n
Characters do not appear on the screen when you type in credentials\n
Please enter an adminstrator username"
private: no
- name: "Password"
prompt: " Password must contain atleast:\n * 8 total printable ASCII character(s).\n Please enter a new password"
private: yes
- name: "Confirm_Password"
prompt: " Please confirm new password"
private: yes
Output
Confirm the endpoint to forward logs .
1. Test1
2. Test2
* Please input either 1 or 2 based on your selection : 1
Splunk software must create an administrator account during startup. Otherwise, you cannot log in.
Create credentials for the administrator account.
Characters do not appear on the screen when you type in credentials
Please enter an administrator username:
There is no new line between first set of prompt and second.
When we run the ansible script, I want the var prompt to be shown this way :
Confirm the endpoint to forward logs .
1. Test1
2. Test2
* Please input either 1 or 2 based on your selection : 1
You selected the option Test1
Splunk software must create an administrator account during startup. Otherwise, you cannot log in.
Create credentials for the administrator account.
Characters do not appear on the screen when you type in credentials
Please enter an administrator username:
How can I do this? Immediately after user gives input, this must be shown: You selected the option Test1
.