debconf-utils package
The debconfmod state module manages the enforcement of debconf selections, this state can set those selections prior to package installation.
The debconfmod state has two functions, the set and set_file functions
Set debconf selections from the state itself
Set debconf selections from a file
nullmailer-debconf:
debconf.set:
- name: nullmailer
- data:
'shared/mailname': {'type': 'string', 'value': 'server.domain.tld'}
'nullmailer/relayhost': {'type': 'string', 'value': 'mail.domain.tld'}
ferm-debconf:
debconf.set:
- name: ferm
- data:
'ferm/enable': {'type': 'boolean', 'value': True}
Note
Due to how PyYAML imports nested dicts (see here),
the values in the data dict must be indented four spaces instead of two.
If you're setting debconf values that requires dpkg-reconfigure, you can use
the onchanges requisite to reconfigure your package:
set-default-shell:
debconf.set:
- name: dash
- data:
'dash/sh': {'type': 'boolean', 'value': false}
reconfigure-dash:
cmd.run:
- name: dpkg-reconfigure -f noninteractive dash
- onchanges:
- debconf: set-default-shell
Every time the set-default-shell state changes, the reconfigure-dash
state will also run.
Note
For boolean types, the value should be true or false, not
'true' or 'false'.
Set debconf selections
<state_id>:
debconf.set:
- name: <name>
- data:
<question>: {'type': <type>, 'value': <value>}
<question>: {'type': <type>, 'value': <value>}
The package name to set answers for.
A set of questions/answers for debconf. Note that everything under this must be indented twice.
The question the is being pre-answered
The type of question that is being asked (string, boolean, select, etc.)
The answer to the question
Set debconf selections from a file or a template
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections?saltenv=myenvironment
<state_id>:
debconf.set_file:
- source: salt://pathto/pkg.selections.jinja2
- template: jinja
- context:
some_value: "false"
The location of the file containing the package selections
If this setting is applied then the named templating engine will be used to render the package selections file, currently jinja, mako, and wempy are supported
Overrides default context variables passed to the template.
Default context passed to the template.