when executes command on remote host we have to give inputs like below . when we give any thing wrong it has to ask second time.
This the response on Remote host when executed command:
*********************************************************
Install Private cloud edition(y/n): y
Enable Monitoring (y/n): y
Configure Firewall (y/n): y
*********************************************************
Enter Virtual IP/Hostname: ***.**.**.*
The Virtual Hostname/IP provided seems to be active
Enter Virtual IP/Hostname:
so I'm trying this from controller node .when I try for expect module where responses is used to match with the string on remote host .so i gave input using prompt but when i give wrong ip it is not stating any error at that point of time. can we achieve like which are there in responses it will get displayed on controller screen so user can give input from there then if we give wrong it will ask for second time.can someone help me on this
This is my code
- pause:
prompt: "Enter Virtual IP/Hostname: "
register: VIP
- name: command
expect:
echo: yes
command: "{{ va }} -c {{ cluster_name }}"
responses:
Install Private cloud edition\(y\/n\): "{{ Private.user_input }}"
Enable Monitoring \(y\/n\): "{{ monitoring.user_input }}"
Configure Firewall \(y\/n\): "{{ firewall.user_input }}"
Enter Virtual IP/Hostname: "{{ VIP.user_input }}"
timeout: 120
echo: yes
ignore_errors: yes
register: promptt ```