--- # Installs and configures the Roundcube webmail interface. - name: Install Roundcube and related packages apt: name: "{{ packages }}" state: present vars: packages: - roundcube - roundcube-core - roundcube-pgsql - roundcube-plugins - roundcube-plugins-extra tags: - dependencies - name: Make logs and temp directories writable by web server file: path=/var/lib/roundcube/{{ item }} mode=0775 state=directory with_items: - temp - logs - name: Make roundcube directory accessible to web server file: path=/var/lib/roundcube group=www-data recurse=yes state=directory - name: Install sieve plugin configuration copy: src=etc_roundcube_plugins_managesieve_config.inc.php dest=/etc/roundcube/plugins/managesieve/config.inc.php owner=root group=www-data mode=0644 - name: Install global sieve copy: src=etc_roundcube_global.sieve dest=/etc/roundcube/global.sieve owner=root group=www-data mode=0644 - name: Set server parameter for Roundcube debconf: name: roundcube-core question: roundcube/hosts value: "ssl://{{ webmail_domain }}:993" vtype: string notify: apply roundcube config - name: Set language for Roundcube debconf: name: roundcube-core question: roundcube/language value: "{{ webmail_language }}" vtype: string notify: apply roundcube config - name: Install Roundcube configuration template: src=etc_roundcube_config.inc.j2 dest=/etc/roundcube/config.inc.php - name: Configure Apache sites for Roundcube template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/mail_{{ item.name }}.conf owner=root group=root force=yes with_items: "{{ virtual_domains }}" notify: restart apache - name: Enable Roundcube sites command: a2ensite mail_{{ item }}.conf creates=/etc/apache2/sites-enabled/mail_{{ item }}.conf with_items: "{{ virtual_domains | json_query('[*].name') }}" notify: restart apache