3

I want to write playbook which installs an application using their installer. I am using ansible's expect module to do this. At the beginning of the installation, it asks to press ENTER to continue with the installation. How do I send expect the ENTER keypress ?

Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54

1 Answers1

1

There’s a linux command called yes which "outputs an affirmative response, or a user-defined string of text".

I didn't check it, but you could try using:

- shell: yes '' | your command goes here

Have a look at simulation keypress in bash script.

Taken from documentation:

If you want to run a command through the shell (say you are using <, >, |, etc), you must specify a shell in the command such as /bin/bash -c "/path/to/something | grep else"

Therefore, you can try /bin/bash -c "echo" or something similar as a response, something like:

responses:
  press_enter: /bin/bash -c "echo"
Community
  • 1
  • 1
Nick Roz
  • 3,918
  • 2
  • 36
  • 57