From d548dfb1309a90e6bb8fe42a81520784894368c1 Mon Sep 17 00:00:00 2001 From: Mike Ashley Date: Sat, 5 Mar 2016 08:42:00 -0500 Subject: [PATCH] Use debconf to configure roundcube for postgresql --- roles/webmail/tasks/roundcube.yml | 15 ++-- .../etc_dbconfig-common_roundcube.conf.j2 | 87 ------------------- .../templates/etc_roundcube_debian-db.php.j2 | 18 ---- 3 files changed, 5 insertions(+), 115 deletions(-) delete mode 100644 roles/webmail/templates/etc_dbconfig-common_roundcube.conf.j2 delete mode 100644 roles/webmail/templates/etc_roundcube_debian-db.php.j2 diff --git a/roles/webmail/tasks/roundcube.yml b/roles/webmail/tasks/roundcube.yml index e33b971..94ee193 100644 --- a/roles/webmail/tasks/roundcube.yml +++ b/roles/webmail/tasks/roundcube.yml @@ -8,8 +8,12 @@ tags: - dependencies -- name: Tell debconf we want to install Roundcube with postgresql backend +- name: Tell debconf how to install Roundcube debconf: name=roundcube-core question='roundcube/database-type' vtype=select value='pgsql' + debconf: name=roundcube-core question='roundcube/pgsql/admin-user' vtype=text value='{{ db_admin_username }}' + debconf: name=roundcube-core question='roundcube/pgsql/admin-pass' vtype=password value='{{ db_admin_password }}' + debconf: name=roundcube-core question='roundcube/db/app-user' vtype=text value='{{ webmail_db_username }}' + debconf: name=roundcube-core question='roundcube/pgsql/app-pass' vtype=password value='{{ webmail_db_password }}' - name: Install Roundcube from jessie-backports apt: pkg={{ item }} state=latest default_release=jessie-backports @@ -21,15 +25,6 @@ tags: - dependencies -- name: Configure Roundcube database - template: src={{ item.src }} dest={{ item.dest }} group={{ item.group }} mode={{ item.mode }} owner=root force=yes - with_items: - - { src: 'etc_dbconfig-common_roundcube.conf.j2', dest: '/etc/dbconfig-common/roundcube.conf', group: 'root', mode: 600 } - - { src: 'etc_roundcube_debian-db.php.j2', dest: '/etc/roundcube/debian-db.php', group: 'www-data', mode: 640 } - -- name: set roundcube password - command: sudo -u {{ db_admin_username }} psql -d {{ webmail_db_database }} -c "ALTER USER {{ webmail_db_username }} with password '{{ webmail_db_password }}';" - - name: Download carddav plugin release get_url: url: https://github.com/blind-coder/rcmcarddav/archive/carddav_{{ carddav_version }}.tar.gz diff --git a/roles/webmail/templates/etc_dbconfig-common_roundcube.conf.j2 b/roles/webmail/templates/etc_dbconfig-common_roundcube.conf.j2 deleted file mode 100644 index 0801186..0000000 --- a/roles/webmail/templates/etc_dbconfig-common_roundcube.conf.j2 +++ /dev/null @@ -1,87 +0,0 @@ -# automatically generated by the maintainer scripts of roundcube -# any changes you make will be preserved, though your comments -# will be lost! to change your settings you should edit this -# file and then run "dpkg-reconfigure roundcube" - -# dbc_install: configure database with dbconfig-common? -# set to anything but "true" to opt out of assistance -dbc_install='true' - -# dbc_upgrade: upgrade database with dbconfig-common? -# set to anything but "true" to opt out of assistance -dbc_upgrade='true' - -# dbc_remove: deconfigure database with dbconfig-common? -# set to anything but "true" to opt out of assistance -dbc_remove='' - -# dbc_dbtype: type of underlying database to use -# this exists primarily to let dbconfig-common know what database -# type to use when a package supports multiple database types. -# don't change this value unless you know for certain that this -# package supports multiple database types -dbc_dbtype='pgsql' - -# dbc_dbuser: database user -# the name of the user who we will use to connect to the database. -dbc_dbuser='{{ webmail_db_username }}' - -# dbc_dbpass: database user password -# the password to use with the above username when connecting -# to a database, if one is required -dbc_dbpass='{{ webmail_db_password }}' - -# dbc_dballow: allowed host to connect from -# only for database types that support specifying the host from -# which the database user is allowed to connect from -# this string defines for which host the dbc_dbuser is allowed -# to connect -# this value is only really used again when you reconfigure the -# package -dbc_dballow='' - -# dbc_dbserver: database host. -# leave unset to use localhost (or a more efficient local method -# if it exists). -dbc_dbserver='localhost' - -# dbc_dbport: remote database port -# leave unset to use the default. only applicable if you are -# using a remote database. -dbc_dbport='' - -# dbc_dbname: name of database -# this is the name of your application's database. -dbc_dbname='{{ webmail_db_database }}' - -# dbc_dbadmin: name of the administrative user -# this is the administrative user that is used to create all of the above -# The exception is the MySQL/MariaDB localhost case, where this value is -# ignored and instead is determined from /etc/mysql/debian.cnf. -dbc_dbadmin='{{ db_admin_username }}' - -# dbc_basepath: base directory to hold database files -# leave unset to use the default. only applicable if you are -# using a local (filesystem based) database. -dbc_basepath='' - -## -## postgresql specific settings. if you don't use postgresql, -## you can safely ignore all of these -## - -# dbc_ssl: should we require ssl? -# set to "true" to require that connections use ssl -dbc_ssl='' - -# dbc_authmethod_admin: authentication method for admin -# dbc_authmethod_user: authentication method for dbuser -# see the section titled "AUTHENTICATION METHODS" in -# /usr/share/doc/dbconfig-common/README.pgsql for more info -dbc_authmethod_admin='' -dbc_authmethod_user='' - -## -## end postgresql specific settings -## - diff --git a/roles/webmail/templates/etc_roundcube_debian-db.php.j2 b/roles/webmail/templates/etc_roundcube_debian-db.php.j2 deleted file mode 100644 index 1a6a0de..0000000 --- a/roles/webmail/templates/etc_roundcube_debian-db.php.j2 +++ /dev/null @@ -1,18 +0,0 @@ -