# APT and packages with interactive configuraton?

**URL:** <https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834>\
**Category:** Get Help\
**Tags:** apt\
**Created:** [September 27, 2024, 10:39pm UTC](https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834 "2024-09-27T22:39:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HiPhish](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hiphish/32/4901_2.png) [@HiPhish](https://forum.ansible.com/u/HiPhish)\
**Post date:** [September 27, 2024, 10:39pm UTC](https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834/1 "2024-09-27T22:39:13Z")

</div>

Hello,

I am trying to set up Postfix on a Debian 12 web server according to [this guide](https://www.linuxbabe.com/mail-server/build-email-server-from-scratch-debian-postfix-smtp). About halfway through the article the author installs Postfix via `sudo apt-get install postfix -y`, which opens an interactive configuration wizard before the package is installed.

I have not been able to find anything the the documentation of `ansible.builtin.apt` for answering these interactive questions. Is there a way, or am I out of luck?

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [September 28, 2024, 1:58pm UTC](https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834/2 "2024-09-28T13:58:27Z")

</div>

@HiPhish  
Hi, try this:

```yaml
- ansible.builtin.apt:
    name: postfix
    state: present
  environment:
    DEBIAN_FRONTEND: noninteractive

```

The `noninteractive` means:

> This is the anti-frontend. It never interacts with you at all, and makes the default answers be used for all questions. It might mail error messages to root, but that’s it; otherwise it is completely silent and unobtrusive, a perfect frontend for automatic installs. If you are using this front-end, and require non-default answers to questions, you will need to preseed the debconf database; see the section below on Unattended Package Installation for more details.  
> [https://manpages.debian.org/jessie/debconf-doc/debconf.7.en.html#Frontends](https://manpages.debian.org/jessie/debconf-doc/debconf.7.en.html#Frontends)

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [September 28, 2024, 2:09pm UTC](https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834/3 "2024-09-28T14:09:23Z")

</div>

You can get and set the answers before installing `postfix` using the [ansible.builtin.debconf module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debconf_module.html), for example to get all the questions and what has been set (a `*` indicates a modified answer) after `postfix` has been installed:

```bash
debconf-show postfix

```

---

<div class="post-metadata">

**Author:** ![HiPhish](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hiphish/32/4901_2.png) [@HiPhish](https://forum.ansible.com/u/HiPhish)\
**Post date:** [September 28, 2024, 10:09pm UTC](https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834/4 "2024-09-28T22:09:53Z")

</div>

Thanks, `debconf` is the mechanism was looking for. It was impossible to find anything useful online searching for “wizard” or “configuration”, but searching for `debconf` gave me the results I needed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 28, 2024, 10:10pm UTC](https://forum.ansible.com/t/apt-and-packages-with-interactive-configuraton/8834/5 "2024-10-28T22:10:23Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
