# Dpkg command issue

**URL:** <https://forum.ansible.com/t/dpkg-command-issue/40260>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [February 14, 2025, 1:10am UTC](https://forum.ansible.com/t/dpkg-command-issue/40260 "2025-02-14T01:10:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saber](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Saber](https://forum.ansible.com/u/Saber)\
**Post date:** [February 14, 2025, 1:10am UTC](https://forum.ansible.com/t/dpkg-command-issue/40260/1 "2025-02-14T01:10:32Z")

</div>

Is the `dpkg-reconfigure -f noninteractive ` command working correctly within an Ansible awx playbook? If not, how can I improve its usage or troubleshoot it?

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [February 14, 2025, 1:48am UTC](https://forum.ansible.com/t/dpkg-command-issue/40260/2 "2025-02-14T01:48:11Z")

</div>

Shouldn’t it be `dpkg-reconfigure -fnoninteractive <packages>`? Also, please share a snippet of your playbook so we can see exactly how you’re trying to execute the command as that will help us help you.

From what I understand, even with `-fnoninteractive`, dpkg may still ask interactive questions if there’s no “default” configuration value, which will cause Ansible to hang since it can’t answer the prompt without using something like pexpect.

My debian is rusty though, so maybe someone like @chris would be more familiar with this.

---

<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:** [February 14, 2025, 11:36am UTC](https://forum.ansible.com/t/dpkg-command-issue/40260/4 "2025-02-14T11:36:29Z")

</div>

You need to use the [ansible.builtin.shell module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html) if you are using `|` and `&&` and you could also try setting the `DEBIAN_FRONTEND` env var to `noninteractive`:

```yaml
   - name: Reconfigure non-interactively
     ansible.builtin.shell: >-
       echo "slapd slapd/domain string {{ sample_domain }}" |
       debconf-set-selections &&
       dpkg-reconfigure -f noninteractive slapd
     environment:
       DEBIAN_FRONTEND: noninteractive
     notify: Reconfigure slapd  

```

However I’d suggest looking at using the [ansible.builtin.debconf module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debconf_module.html) for this.
