如何让ansible对sendmailconfig要求的所有内容回答"是"

kra*_*r65 2 linux bash sendmail command-line-interface ansible

我正在设置一个带有ansible的服务器,我想安装和配置sendmail.要做到这一点,我首先使用apt安装它,然后我需要运行sendmailconfigAND asnwer y它问的所有问题.

最后一部分是我认为最难的部分.sendmailconfig没有-y一面旗帜可以回答所有问题,所以我如何让Ansible简单地同意它所要求的所有问题?

Ini*_*ian 12

只需使用yesshell实用程序,

yes 'y' | <command-name>
#    ^^The repeated string being 'yes' as the OP had asked.
Run Code Online (Sandbox Code Playgroud)

man页面,

NAME
       yes - output a string repeatedly until killed

SYNOPSIS
       yes [STRING]...
       yes OPTION

DESCRIPTION
       Repeatedly output a line with all specified STRING(s), or 'y'.
Run Code Online (Sandbox Code Playgroud)