如何通过 Ansible 响应“是/否”命令提示符?

Doc*_*Doc 7 ansible ansible-tower

我正在运行:

- command: vsx update-software ...
Run Code Online (Sandbox Code Playgroud)

命令在主机上执行更新,该命令要求输入“y”以继续执行。
默认情况下,命令会以“yes”执行,还是应该添加 Ansdible 指令以响应“yes”?如果是的话请问哪个指令?

fra*_*ijo 7

使用该expect模块,

- name: Upgrading Software
  expect:
    command: vsx update-software
    responses:
      'First Question in the prompt' : 'y'
      'Second Question in the prompt' : 'y'
Run Code Online (Sandbox Code Playgroud)

更多信息可以在这里expect找到。