I have below shell script which require user input:
read -e -p "Enter any string:" varible
echo 'Entered value is ::' $varible > abc.txt
I wanted to run this script which requires user input in multiple servers and achieved using below yml :
- name: Here we start
hosts: all
tasks: # is a list
- name: Execute the user interactive script
expect:
command: /usr/bin/sh /home/ansible/test.sh
responses:
"Enter any string:": "Success Script Executed"
But same if am trying using below command its not promoting for user input:
ansible all -a 'sh /home/ansible/test.sh'
1)Please share correct ansible command that asks for user input for my script above.
2)Also for my script above please share correct ansible command that takes default value behalf user.