- name: Determine whether roundcube is configured stat: path=/var/www/roundcube/config.inc.php register: roundcube_config - name: Install roundcube dependencies (PHP5 variant) apt: pkg={{ item }} state=present with_items: - php5 - php5-sqlite - php5-mcrypt - php5-gd - php5-pspell - php5-intl - php5-curl - aspell - aspell-en when: (ansible_distribution_release != "xenial" and ansible_distribution_release != "bionic" and ansible_distribution_release != "stretch") tags: - dependencies - name: Install roundcube dependencies apt: pkg={{ item }} state=present with_items: - php - php-sqlite3 - php-mbstring - php-mcrypt - php-gd - php-pspell - php-intl - php-curl - php-xml - aspell - aspell-en when: (ansible_distribution_release == "xenial" or ansible_distribution_release == "bionic" or ansible_distribution_release == "stretch") tags: - dependencies - name: Clone roundcube git: repo=https://github.com/roundcube/roundcubemail.git dest=/var/www/roundcube version={{ webmail_version }} update=no accept_hostkey=yes - name: Get Composer installer get_url: url=https://getcomposer.org/installer dest=/tmp/composer-installer - name: Copy composer configuration copy: src=var_www_roundcube_composer.json dest=/var/www/roundcube/composer.json owner=root group=www-data mode=0644 - name: Install Composer command: php /tmp/composer-installer chdir=/root creates=/root/composer.phar - name: Initialize composer command: php /root/composer.phar install --no-dev chdir=/var/www/roundcube creates=/var/www/roundcube/vendor/autoload.php - name: Remove installer directory file: path=/var/www/roundcube/installer state=absent - name: Install Roundcube configuration template: src=var_www_roundcube_config_config.inc.j2 dest=/var/www/roundcube/config/config.inc.php - name: Create db directory file: path=/data/roundcube group=www-data mode=0775 state=directory - name: Make logs and temp directories writable by web server file: path=/var/www/roundcube/{{ item }} mode=0775 state=directory with_items: - temp - logs - name: Make roundcube directory accessible to web server file: path=/var/www/roundcube group=www-data recurse=yes state=directory - name: Install sieve plugin configuration copy: src=var_www_roundcube_plugins_managesieve_config.inc.php dest=/var/www/roundcube/plugins/managesieve/config.inc.php owner=root group=www-data mode=0644 - name: Install global sieve copy: src=var_www_roundcube_config_global.sieve dest=/var/www/roundcube/config/global.sieve owner=root group=www-data mode=0644 - name: Install carddav plugin configuration copy: src=var_www_roundcube_plugins_carddav_config.inc.php dest=/var/www/roundcube/plugins/carddav/config.inc.php owner=root group=www-data mode=0644 - name: Configure Apache 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 Roundcube site command: a2ensite roundcube.conf creates=/etc/apache2/sites-enabled/roundcube.conf notify: restart apache