ansible handling stdin input

17 views
Skip to first unread message

Benny Kusman

unread,
Apr 9, 2018, 5:57:44 AM4/9/18
to Ansible Project
Hi 

Hopefully someone has encountered and resolved this issue.

supposedly my playbook:
- main: execute script
  shell: "/home/settingip"

when executing the program, it will run and require stdin/keyboard input, such as IP, hostname, etc.

can i pre-fill this in ansible ? knowing that the prompt will have the same question everytime the command runs

Thank you!


Richard Hector

unread,
Apr 9, 2018, 6:04:51 AM4/9/18
to ansible...@googlegroups.com
On 09/04/18 21:57, Benny Kusman wrote:
> Hi 
>
> Hopefully someone has encountered and resolved this issue.
>
> supposedly my playbook:
> *- main: execute script*
> *  shell: "/home/settingip"*
>
> when executing the program, it will run and require stdin/keyboard
> input, such as IP, hostname, etc.
>
> can i pre-fill this in ansible ? knowing that the prompt will have the
> same question everytime the command runs

Have a look at the expect module:

https://docs.ansible.com/ansible/latest/modules/expect_module.html

Richard

Benny Kusman

unread,
Apr 9, 2018, 9:32:02 AM4/9/18
to Ansible Project
thanks Richard!
Reply all
Reply to author
Forward
0 new messages