When installing packages on debian/ubuntu, there is a chance the package installation will include some questions to be answered.
On ansible you shouldn’t setup any terminal expectation since it will be defeating the purpose of automation, to add automatic answers to apt
, you should add them to debconf like this:
- name: debconf pre-selection for postfix install
debconf:
name: postfix
question: postfix/main_mailer_type
vtype: string
value: "Internet Site"
tags: postfix
To read more about debconf, please check this stackoverflow answer.