forked from mauro/ansible-role-nextcloud-docker
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f46332a83f |
@@ -1,39 +1,20 @@
|
||||
---
|
||||
# domain, webroot
|
||||
roundcube_domain: default
|
||||
roundcube_web_root: /roundcube
|
||||
roundcube_version: 1.3.10
|
||||
|
||||
# container
|
||||
roundcube_image: eumau/roundcubemail:{{ roundcube_version }}
|
||||
roundcube_container: roundcube
|
||||
roundcube_volume: roundcube
|
||||
mariadb_image: mariadb
|
||||
mariadb_container: mariadb
|
||||
mariadb_volume: mariadb
|
||||
|
||||
# mysql, mariadb, postgresql
|
||||
roundcube_db_type: sqlite
|
||||
roundcube_db_host: localhost
|
||||
roundcube_db_port: "{{ '5432' if 'post' in roundcube_db_type else '3306' }}"
|
||||
roundcube_db_user: roundcube
|
||||
roundcube_db_password: password
|
||||
roundcube_db_name:
|
||||
roundcube{{ '.sqlite' if roundcube_db_type == 'sqlite' else '' }}
|
||||
# clave del usuario root (CAMBIAR)
|
||||
mariadb_root_password: password
|
||||
|
||||
# data dir (inside container)
|
||||
roundcube_data_dir: /var/www/html
|
||||
# base de datos y usuario (opcionales)
|
||||
# mariadb_database: db
|
||||
# mariadb_user: db_user
|
||||
# mariadb_password: db_pass
|
||||
|
||||
# imap
|
||||
roundcube_imap_host: "tls://{{ dovecot_container | default('localhost') }}"
|
||||
roundcube_imap_port: "143"
|
||||
|
||||
# smtp
|
||||
roundcube_smtp_host: "tls://{{ postfix_container | default('localhost') }}"
|
||||
roundcube_smtp_port: "587"
|
||||
|
||||
# plugins
|
||||
roundcube_plugins: []
|
||||
|
||||
# upload max filesize
|
||||
roundcube_upload_max_filesize: 40M
|
||||
# binding del puerto mariadb
|
||||
mariadb_bind_host: 127.0.0.1
|
||||
mariadb_bind_port: 3306
|
||||
|
||||
# definido por rol docker
|
||||
docker_network_name: dockernet
|
||||
|
||||
116
tasks/main.yml
116
tasks/main.yml
@@ -1,108 +1,38 @@
|
||||
---
|
||||
# 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:
|
||||
- name: install deps
|
||||
pip:
|
||||
name: PyMySQL
|
||||
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
|
||||
- name: start mariadb container
|
||||
docker_container:
|
||||
image: "{{ roundcube_image }}"
|
||||
name: "{{ roundcube_container }}"
|
||||
image: "{{ mariadb_image }}"
|
||||
name: "{{ mariadb_container }}"
|
||||
volumes:
|
||||
- "{{ roundcube_volume }}:/var/www/html"
|
||||
- "{{ mariadb_volume }}:/var/lib/mysql"
|
||||
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 }}"
|
||||
MYSQL_ROOT_PASSWORD: "{{ mariadb_root_password }}"
|
||||
MYSQL_DATABASE: "{{ mariadb_database | default(omit) }}"
|
||||
MYSQL_USER: "{{ mariadb_user | default(omit) }}"
|
||||
MYSQL_PASSWORD: "{{ mariadb_password | default(omit) }}"
|
||||
networks:
|
||||
- name: "{{ docker_network_name }}"
|
||||
ports:
|
||||
- "{{ mariadb_bind_host }}:{{ mariadb_bind_port }}:3306"
|
||||
|
||||
- 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, recursive=True) }}
|
||||
|
||||
- name: inspect roundcube volume
|
||||
- name: inspect mariadb volume
|
||||
docker_volume_info:
|
||||
name: "{{ roundcube_volume }}"
|
||||
name: "{{ mariadb_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,
|
||||
),
|
||||
);
|
||||
mariadb_container: "{{ lookup('vars','mariadb_container') }}"
|
||||
mariadb_volume: "{{ lookup('vars','mariadb_volume') }}"
|
||||
mariadb_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
|
||||
mariadb_root_password: "{{ lookup('vars','mariadb_root_password') }}"
|
||||
mariadb_database: "{{ lookup('vars','mariadb_database',default=omit) }}"
|
||||
mariadb_user: "{{ lookup('vars','mariadb_user',default=omit) }}"
|
||||
mariadb_password: "{{ lookup('vars','mariadb_password',default=omit) }}"
|
||||
mariadb_host: localhost
|
||||
mariadb_port: "{{ lookup('vars','mariadb_bind_port') }}"
|
||||
|
||||
Reference in New Issue
Block a user