ansible.builtin.debconf – Configure a .deb package

Note

This module is part of ansible-base and included in all Ansible installations. In most cases, you can use the short module name debconf even without specifying the collections: keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.

New in version 1.6: of ansible.builtin

Synopsis

  • Configure a .deb package using debconf-set-selections.

  • Or just query existing selections.

Requirements

The below requirements are needed on the host that executes this module.

  • debconf

  • debconf-utils

Parameters

Parameter Choices/Defaults Comments
name
string / required
Name of package to configure.

aliases: pkg
question
string
A debconf configuration setting.

aliases: selection, setting
unseen
boolean
    Choices:
  • no ←
  • yes
Do not set 'seen' flag when pre-seeding.
value
string
Value to set the configuration to.

aliases: answer
vtype
string
    Choices:
  • boolean
  • error
  • multiselect
  • note
  • password
  • seen
  • select
  • string
  • text
  • title
The type of the value supplied.
It is highly recommended to add no_log=True to task while specifying vtype=password.
seen was added in Ansible 2.2.

Notes

Note

  • This module requires the command line debconf tools.

  • A number of questions have to be answered (depending on the package). Use ‘debconf-show <package>’ on any Debian or derivative with the package installed to see questions/settings available.

  • Some distros will always record tasks involving the setting of passwords as changed. This is due to debconf-get-selections masking passwords.

  • It is highly recommended to add no_log=True to task while handling sensitive information using this module.

  • Supports check_mode.

Examples

- name: Set default locale to fr_FR.UTF-8
  ansible.builtin.debconf:
    name: locales
    question: locales/default_environment_locale
    value: fr_FR.UTF-8
    vtype: select

- name: Set to generate locales
  ansible.builtin.debconf:
    name: locales
    question: locales/locales_to_be_generated
    value: en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8
    vtype: multiselect

- name: Accept oracle license
  ansible.builtin.debconf:
    name: oracle-java7-installer
    question: shared/accepted-oracle-license-v1-1
    value: 'true'
    vtype: select

- name: Specifying package you can register/return the list of questions and current values
  ansible.builtin.debconf:
    name: tzdata

- name: Pre-configure tripwire site passphrase
  ansible.builtin.debconf:
    name: tripwire
    question: tripwire/site-passphrase
    value: "{{ site_passphrase }}"
    vtype: password
  no_log: True

Authors

  • Brian Coca (@bcoca)