How to respond to a Yes / No command prompt via Ansible?

Viewed 4884

I'm running a :

- command: vsx update-software ...

command to perform an update on a host, the command requests to enter "y" to go ahead with its exection.
Will the command be executed with "yes" by default or should I add an Ansdible directive to respond with "yes" ? if so which directive please ?

1 Answers

Use the expect module,

- name: Upgrading Software
  expect:
    command: vsx update-software
    responses:
      'First Question in the prompt' : 'y'
      'Second Question in the prompt' : 'y'

More on expect can be found here.

Related