Hi,
Debconf and its pair tools can be used to reconfigure a Debian package, or to
preconfigure packages before they get installed.
It can be really handy, especially for web application packages in Debian such
as roundcube or phpmyadmin.
Until recently, I used to transfert a subset of the output of
debconf-get-selections in a file (copy) and pass its content to
debconf-set-selections (shell), then call dpkg-reconfigure package (command)...
I wrote a simple module that makes all these steps and checks the current
configuration before calling debconf-set-selections, so that ansible reports
whether there were changes or not.
It requires debconf-utils on the target machine.
For example:
- name: configure roundcube
debconf: pkg=roundcube keys='$TEMPLATE(roundcube)' reconfigure=no
Use a template to feed debconf-set-selections with debconf keys/values.
The format of 'keys' is the same as the output of debconf-get-selections, except
the first column (the package name) is removed.
For example:
roundcube/mysql/admin-pass password {{ mysql_root_password }}
roundcube/mysql/method select unix socket
roundcube/dbconfig-install boolean true
roundcube/db/dbname string roundcube
roundcube/dbconfig-upgrade boolean true
roundcube/mysql/admin-user string root
roundcube/pgsql/method select unix socket
roundcube/hosts string 127.0.0.1
roundcube/database-type select mysql
roundcube/db/app-user string roundcube
roundcube/language select fr_FR.UTF-8
Using TEMPLATE or FILE macros are not required, but makes it easier to pass
multiple debconf keys.
'reconfigure' defaults to yes and if so, calls 'dpkg-reconfigure $pkg'.
So:
* Do you guys believe it would be useful ?
* Any comments on the debconf/feature side ?
* I'm not used to coding in python. Any comments on the style would be appreciated
Source: https://github.com/zecrazytux/ansible/blob/library/debconf/library/debconf
Pull request: https://github.com/ansible/ansible/pull/2456
Michael: yup, I'll change the example part of the documentation to the new format
Thanks,