- name: set roundcube_cfg set_fact: roundcube_cfg: "{{ roundcube_default_config | d({}) | combine(roundcube_config | d({}), recursive=true) }}" - name: install dependencies package: name: - php8 - curl - libgd - php8-fpm - aspell-libs - aspell-en - aspell-ru - aspell - aspell-lang - gnupg - name: install php dependencies package: name: - php8-dom - php8-session - php8-xml - php8-intl - php8-json - php8-pdo - php8-pdo_mysql - php8-pdo_pgsql - php8-mbstring - php8-openssl - php8-ctype - php8-curl - php8-fileinfo - php8-exif - php8-iconv - php8-gd - php8-zip - php8-pspell - php8-pcntl - php8-xmlwriter - php8-tokenizer - name: create user and group include_tasks: tasks/create_user.yml vars: user: name: "{{ roundcube_user }}" group: "{{ roundcube_group }}" dir: "{{ roundcube_dir }}" create_home: no - name: create roundcube directory structure file: path: "{{ item.path }}" state: directory mode: "{{ item.mode }}" owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" loop: - path: "{{ roundcube_dir }}" mode: "0775" - path: "{{ roundcube_enigma_dir }}" mode: "0770" - name: install php and php-fpm include_role: name: php vars: php_version: 8 php_install_fpm: yes php_fpm_user: "{{ roundcube_user }}" php_fpm_group: "{{ roundcube_group }}" php_fpm_socket: "{{ roundcube_fpm_socket }}" php_fpm_listener: roundcube php_config: file_uploads: yes session.auto_start: 0 mbstring.func_overload: 0 pcre.backtrack_limit: 200000 upload_max_filesize: "{{ (mail_server.max_mail_size_bytes / 1024) | int | abs }}K" post_max_size: "{{ (mail_server.max_mail_size_bytes / 1024) | int | abs }}K" allow_url_fopen: yes - name: install and configure nginx include_role: name: nginx vars: nginx: servers: - conf: nginx_server certs: "{{ host_tls }}" group: "{{ roundcube_group }}" fastcgi: yes - name: get latest version of roundcube include_tasks: get_lastversion.yml vars: package: name: roundcube/roundcubemail location: github assets: yes asset_filter: 'complete.tar.gz$' file: "{{ roundcube_dir }}/last_version" extract: "{{ roundcube_dir }}" user: "{{ roundcube_user }}" group: "{{ roundcube_group }}" notify: restart php fpm strip_first_dir: yes - name: ensure roundcube logs/temp directories are writable file: path: "{{ roundcube_dir ~ '/' ~ item }}" mode: 0775 state: directory loop: - logs - temp - name: download mime types get_url: url: https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types dest: "{{ roundcube_dir }}/config/{{ roundcube_mime_types_file }}" mode: 0440 owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" notify: restart php fpm - name: create custom directory file: path: "{{ roundcube_dir }}/public_html/custom" mode: 0775 owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" state: directory - name: upload files to custom directory copy: src: "{{ item }}" dest: "{{ roundcube_dir }}/public_html/custom/{{ item }}" mode: 0444 owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" loop: - favicon_mail.ico - logo_mail.png notify: restart php fpm when: roundcube_custom_logo | d(false) == true - name: template roundcube config template: src: config.j2 dest: "{{ roundcube_dir }}/config/config.inc.php" force: yes mode: 0660 owner: "{{ roundcube_user }}" group: "{{ roundcube_group }}" lstrip_blocks: yes notify: restart php fpm - name: delete sample config file: path: "{{ roundcube_dir }}/config/config.inc.php.sample" state: absent - name: setup database include_tasks: db.yml - name: install plugins include_tasks: plugin.yml loop: "{{ roundcube_plugins }}" loop_control: loop_var: plugin - name: add cleandb cron job cron: name: roundcube database cleanup job: "{{ roundcube_dir }}/bin/cleandb.sh 2>&1 /dev/null" hour: "5" minute: "0" user: "{{ roundcube_user }}" - name: flush handlers meta: flush_handlers - name: add directories to backup plan include_role: name: backup vars: function: add backup_items: - "{{ roundcube_dir }}" - "{{ roundcube_enigma_dir }}"