ansible用预先回答回答提示

ansible用预先回答回答提示,ansible,Ansible,我必须卸载一个软件,在卸载该软件时,它会提示我寻找一个答案,答案是yes或no。。给出下面的示例 # /opt/altiris/notification/nsagent/bin/aex-uninstall This will remove the Symantec Management Agent for UNIX, Linux and Mac software from your system. Are you sure you want to continue [Yy/Nn]? 现在,由

我必须卸载一个软件,在卸载该软件时,它会提示我寻找一个答案,答案是
yes或no
。。给出下面的示例

# /opt/altiris/notification/nsagent/bin/aex-uninstall
This will remove the Symantec Management Agent for UNIX, Linux and Mac software from your system.

Are you sure you want to continue [Yy/Nn]?
现在,由于我有多个Linux系统要做,因此我正在寻找ansible来为我做这项工作,因此,我刚刚用ansible
adhoc
方法测试了相同的功能,如下所示,它与
shell
模块一起工作

# ansible all -m shell -a 'echo "y" | /opt/altiris/notification/nsagent/bin/aex-uninstall'
dev-karn | SUCCESS | rc=0 >>
This will remove the Symantec Management Agent for UNIX, Linux and Mac software from your system.

Are you sure you want to continue [Yy/Nn]?

Uninstalling dependant solutions...
Uninstalling dependant solutions finished.

Removing Symantec Management Agent for UNIX, Linux and Mac package from the system...
Removing wrapper scripts and links for applications...
Sending uninstall events to NS
Stopping Symantec Management Agent for UNIX, Linux and Mac: [  OK  ]
Remove non packaged files.
Symantec Management Agent for UNIX, Linux and Mac Configuration utility.
  Removing aex-* links in /usr/bin
  Removing RC init links and scripts
Cleaning up after final package removal.
Removal finished.
有没有更好的方法。。。
您应该使用Ansible模块。

您应该使用Ansible模块。

linux shell的
yes
实用程序反复输出
y
,它满足了通过程序寻找提示的每个预先答案的必要性,从而满足了我的要求,因为我正在运行的程序只需要答案是
yes
继续,因此我将其与ansible
shell
模块一起使用,如下所示

$ ansible all -m shell -a '/bin/yes | /opt/altiris/notification/nsagent/bin/aex-uninstall'
因此,即使是
echo“y”
也不需要


Thnx-Karn

linux shell的
yes
实用程序反复输出
y
,它满足了通过程序寻找提示的每个预先答案的必要性,从而满足了我的要求,因为我正在运行的程序只需要回答
yes
即可继续运行,因此,我将其与ansible
shell
module一起使用,如下所示

$ ansible all -m shell -a '/bin/yes | /opt/altiris/notification/nsagent/bin/aex-uninstall'
因此,即使是
echo“y”
也不需要


Thnx-Karn

Thnx为了您的回复,我看到了一份可靠的文件。但最终的解决方案是,
yes
实用程序反复输出y,这满足了我看到的ob-ansible doc的还原要求nx。但最终的解决方案是
yes
实用程序反复输出y,满足了要求