109 lines
3.4 KiB
YAML
109 lines
3.4 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: export nginx config
|
|
set_fact:
|
|
nginx_config: >-
|
|
{{ nginx_config | default({}) | combine({
|
|
roundcube_domain: {
|
|
"locations": {
|
|
roundcube_web_root.rstrip('/')+'/': {
|
|
"proxy_pass": "http://{}:9080/".format(roundcube_container)
|
|
}
|
|
}
|
|
}
|
|
}) }}
|
|
|
|
- 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 }}"
|
|
|
|
- name: allow self-signed mail server certs
|
|
blockinfile:
|
|
state: present
|
|
path: "{{ roundcube_volume_mountpoint }}/config/config.inc.php"
|
|
block: |
|
|
$config['imap_conn_options'] = array(
|
|
'ssl' => array(
|
|
'verify_peer' => false,
|
|
'verify_peer_name' => false,
|
|
),
|
|
);
|
|
$config['smtp_conn_options'] = array(
|
|
'ssl' => array(
|
|
'verify_peer' => false,
|
|
'verify_peer_name' => false,
|
|
),
|
|
);
|