101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
---
|
|
# TODO: postgres support
|
|
# - name: create roundcube database (pg)
|
|
# postgresql_db:
|
|
# state: present
|
|
# name: "{{ roundcube_db_name }}"
|
|
# login_host: "{{ postgresql_host }}"
|
|
# login_port: "{{ postgresql_port }}"
|
|
# login_user: "{{ postgresql_root_password }}"
|
|
# login_password: "{{ postgresql_root_password }}"
|
|
|
|
# - name: create roundcube db user (pg)
|
|
# postgresql_user:
|
|
# state: present
|
|
# name: "{{ roundcube_db_user }}"
|
|
# password: "{{ roundcube_db_password }}"
|
|
# priv: "{{ roundcube_db_name }}.*:ALL"
|
|
# login_host: "{{ postgresql_host }}"
|
|
# login_port: "{{ postgresql_port }}"
|
|
# login_user: root
|
|
# login_password: "{{ postgresql_root_password }}"
|
|
|
|
- name: create roundcube database
|
|
mysql_db:
|
|
state: present
|
|
name: "{{ roundcube_db_name }}"
|
|
login_host: "{{ mariadb_host }}"
|
|
login_port: "{{ mariadb_port }}"
|
|
login_user: root
|
|
login_password: "{{ mariadb_root_password }}"
|
|
when: roundcube_db_type in ('mariadb','mysql')
|
|
|
|
- name: create roundcube db user
|
|
mysql_user:
|
|
state: present
|
|
name: "{{ roundcube_db_user }}"
|
|
host: "%"
|
|
password: "{{ roundcube_db_password }}"
|
|
priv: "{{ roundcube_db_name }}.*:ALL"
|
|
login_host: "{{ mariadb_host }}"
|
|
login_port: "{{ mariadb_port }}"
|
|
login_user: root
|
|
login_password: "{{ mariadb_root_password }}"
|
|
when: roundcube_db_type in ('mariadb','mysql')
|
|
|
|
- name: start roundcube container
|
|
docker_container:
|
|
image: "{{ roundcube_image }}"
|
|
name: "{{ roundcube_container }}"
|
|
volumes:
|
|
- "{{ roundcube_volume }}:/var/www/html"
|
|
env:
|
|
ROUNDCUBEMAIL_DEFAULT_HOST: "{{ roundcube_imap_host }}"
|
|
ROUNDCUBEMAIL_DEFAULT_PORT: "{{ roundcube_imap_port }}"
|
|
ROUNDCUBEMAIL_SMTP_SERVER: "{{ roundcube_smtp_host }}"
|
|
ROUNDCUBEMAIL_SMTP_PORT: "{{ roundcube_smtp_port }}"
|
|
ROUNDCUBEMAIL_PLUGINS: "{{ roundcube_plugins | join (',') }}"
|
|
ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE: "{{ roundcube_upload_max_filesize }}"
|
|
ROUNDCUBEMAIL_DB_TYPE: "{{ roundcube_db_type }}"
|
|
ROUNDCUBEMAIL_DB_HOST: "{{ roundcube_db_host }}"
|
|
ROUNDCUBEMAIL_DB_PORT: "{{ roundcube_db_port }}"
|
|
ROUNDCUBEMAIL_DB_USER: "{{ roundcube_db_user }}"
|
|
ROUNDCUBEMAIL_DB_PASSWORD: "{{ roundcube_db_password }}"
|
|
ROUNDCUBEMAIL_DB_NAME: "{{ roundcube_db_name }}"
|
|
networks:
|
|
- name: "{{ docker_network_name }}"
|
|
ports:
|
|
|
|
- name: template nginx domain config
|
|
when: roundcube_domain != 'default'
|
|
include_role:
|
|
name: nginx-docker
|
|
tasks_from: domain.yml
|
|
vars:
|
|
ng_domain_name: "{{ roundcube_domain }}"
|
|
|
|
- name: template nginx location config
|
|
include_role:
|
|
name: nginx-docker
|
|
tasks_from: location.yml
|
|
vars:
|
|
ng_domain_name: "{{ roundcube_domain }}"
|
|
ng_location_name: "{{ roundcube_web_root }}"
|
|
ng_location_content: |
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_pass http://{{ roundcube_container }}/;
|
|
|
|
- meta: flush_handlers
|
|
|
|
- name: inspect roundcube volume
|
|
docker_volume_info:
|
|
name: "{{ roundcube_volume }}"
|
|
register: volinfo
|
|
|
|
- name: export variables
|
|
set_fact:
|
|
roundcube_volume: "{{ lookup('vars','roundcube_volume') }}"
|
|
roundcube_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
|