- name: Install Roundcube apt: pkg={{ item }} state=latest with_items: - roundcube - roundcube-pgsql - roundcube-plugins 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 } notify: set roundcube password - name: Download carddav plugin release get_url: url=https://github.com/blind-coder/rcmcarddav/archive/carddav_{{ carddav_version }}.tar.gz dest=/root/carddav_{{ carddav_version }}.tar.gz - name: Decompress carddav plugin source unarchive: src=/root/carddav_{{ carddav_version }}.tar.gz dest=/root copy=no creates=/root/rcmcarddav-carddav_{{ carddav_version }} - name: Move carddav plugin files to /usr/share/roundcube/plugins/carddav command: mv rcmcarddav-carddav_{{ carddav_version }} /usr/share/roundcube/plugins/carddav chdir=/root creates=/usr/share/roundcube/plugins/carddav - name: Download Google Authenticator roundcube plugin git: repo=https://github.com/alexandregz/twofactor_gauthenticator.git dest=/usr/share/roundcube/plugins/twofactor_gauthenticator accept_hostkey=yes version=master - name: Link plugins into /var/lib/roundcube/plugins file: state=link src=/usr/share/roundcube/plugins/{{ item }} dest=/var/lib/roundcube/plugins/{{ item }} force=yes with_items: - carddav - twofactor_gauthenticator - name: Rename existing Apache roundcube virtualhost command: mv /etc/apache2/sites-available/roundcube /etc/apache2/sites-available/roundcube.conf removes=/etc/apache2/sites-available/roundcube - name: Remove old sites-enabled/roundcube symlink (new one will be created by a2ensite) file: path=/etc/apache2/sites-enabled/roundcube state=absent - name: Configure the Apache HTTP server for roundcube template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/roundcube.conf group=root owner=root force=yes - name: Enable php5-mcrypt file: src=/etc/php5/mods-available/mcrypt.ini dest=/etc/php5/apache2/conf.d/20-mcrypt.ini owner=root group=root state=link - name: Configure roundcube copy: src={{ item.src }} dest={{ item.dest }} group=www-data owner=root mode=640 force=yes with_items: - { src: 'etc_roundcube_global.sieve', dest: '/etc/roundcube/global.sieve' } - { src: 'etc_roundcube_main.inc.php', dest: '/etc/roundcube/main.inc.php' } - { src: 'usr_share_roundcube_plugins_carddav_config.inc.php', dest: '/usr/share/roundcube/plugins/carddav/config.inc.php' } - { src: 'usr_share_roundcube_plugins_managesieve_config.inc.php', dest: '/usr/share/roundcube/plugins/managesieve/config.inc.php' } - { src: 'usr_share_roundcube_plugins_twofactor_gauthenticator_config.inc.php', dest: '/usr/share/roundcube/plugins/twofactor_gauthenticator/config.inc.php' } - name: Enable roundcube site command: a2ensite roundcube.conf creates=/etc/apache2/sites-enabled/roundcube.conf notify: restart apache