如何通过 Ansible 响应是/否命令提示符?
How to respond to a Yes / No command prompt via Ansible?
我是 运行 一个 :
- command: vsx update-software ...
命令在主机上执行更新,命令请求输入 "y" 继续执行。
该命令将默认使用 "yes" 执行,还是我应该添加 Ansdible 指令以响应 "yes" ?如果是这样,请问哪个指令?
使用expect
模块,
- name: Upgrading Software
expect:
command: vsx update-software
responses:
'First Question in the prompt' : 'y'
'Second Question in the prompt' : 'y'
有关 expect
的更多信息,请参见 here。
我是 运行 一个 :
- command: vsx update-software ...
命令在主机上执行更新,命令请求输入 "y" 继续执行。
该命令将默认使用 "yes" 执行,还是我应该添加 Ansdible 指令以响应 "yes" ?如果是这样,请问哪个指令?
使用expect
模块,
- name: Upgrading Software
expect:
command: vsx update-software
responses:
'First Question in the prompt' : 'y'
'Second Question in the prompt' : 'y'
有关 expect
的更多信息,请参见 here。