Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let ansible answer "yes" to everything sendmailconfig asks

I'm setting up a server with ansible, and I want to install and configure sendmail. To do this I first install it using apt, and then I need to run sendmailconfig AND asnwer y to all the questions it asks.

That last part is the hardest I think. sendmailconfig doesn't have a -y flag to answer yes to everything, so how do I get Ansible to simple agree to all questions it asks?

like image 429
kramer65 Avatar asked Nov 30 '22 22:11

kramer65


1 Answers

Just use the yes shell utility,

yes 'y' | <command-name>
#    ^^The repeated string being 'yes' as the OP had asked.

From the man page,

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'.
like image 195
Inian Avatar answered Dec 04 '22 05:12

Inian