forked from mauro/ansible-role-mysql-docker
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aef469fa91 | ||
|
|
35cd435135 | ||
|
|
769c69f166 | ||
|
|
9f8f664ed7 | ||
| 33eda44c16 | |||
|
|
23aba0b59e | ||
|
|
188f7f87ac | ||
|
|
1378d4d677 | ||
|
|
9fbe0c3a20 | ||
|
|
18fb1c7445 | ||
|
|
d66cd019d6 | ||
|
|
e5507857df | ||
|
|
d8ce72e9d1 | ||
|
|
5d36d9edc5 | ||
|
|
a9ff4f484b | ||
|
|
4c6f2f31da | ||
|
|
b049fb68a9 | ||
|
|
2610cd4ef1 | ||
|
|
ed73b0bc2e | ||
|
|
f04a93096a | ||
|
|
a47d2c8380 | ||
| 003e1c0cd4 | |||
| 5b0ef38aad | |||
| 2b44725360 | |||
|
|
0c237c3be3 | ||
|
|
98700949b7 | ||
|
|
8a4581ad65 | ||
|
|
76b464bab5 | ||
|
|
8a0c733440 | ||
|
|
1b0bb82bb2 | ||
|
|
34f09097df | ||
|
|
d6694d5a3e | ||
|
|
7d6f8e6ade | ||
|
|
2e8cafaa33 | ||
|
|
e6f31d527b |
@@ -1,20 +1,39 @@
|
|||||||
---
|
---
|
||||||
|
# domain, webroot
|
||||||
|
roundcube_domain: default
|
||||||
|
roundcube_web_root: /roundcube
|
||||||
|
roundcube_version: 1.3.10
|
||||||
|
|
||||||
# container
|
# container
|
||||||
mariadb_image: mariadb
|
roundcube_image: eumau/roundcubemail:{{ roundcube_version }}
|
||||||
mariadb_container: mariadb
|
roundcube_container: roundcube
|
||||||
mariadb_volume: mariadb
|
roundcube_volume: roundcube
|
||||||
|
|
||||||
# clave del usuario root (CAMBIAR)
|
# mysql, mariadb, postgresql
|
||||||
mariadb_root_password: password
|
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 '' }}
|
||||||
|
|
||||||
# base de datos y usuario (opcionales)
|
# data dir (inside container)
|
||||||
# mariadb_database: db
|
roundcube_data_dir: /var/www/html
|
||||||
# mariadb_user: db_user
|
|
||||||
# mariadb_password: db_pass
|
|
||||||
|
|
||||||
# binding del puerto mariadb
|
# imap
|
||||||
mariadb_bind_host: 127.0.0.1
|
roundcube_imap_host: "tls://{{ dovecot_container | default('localhost') }}"
|
||||||
mariadb_bind_port: 3306
|
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
|
||||||
|
|
||||||
# definido por rol docker
|
# definido por rol docker
|
||||||
docker_network_name: dockernet
|
docker_network_name: dockernet
|
||||||
|
|||||||
115
tasks/main.yml
115
tasks/main.yml
@@ -1,33 +1,108 @@
|
|||||||
---
|
---
|
||||||
- name: start mariadb container
|
# 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:
|
docker_container:
|
||||||
image: "{{ mariadb_image }}"
|
image: "{{ roundcube_image }}"
|
||||||
name: "{{ mariadb_container }}"
|
name: "{{ roundcube_container }}"
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ mariadb_volume }}:/var/lib/mysql"
|
- "{{ roundcube_volume }}:/var/www/html"
|
||||||
env:
|
env:
|
||||||
MYSQL_ROOT_PASSWORD: "{{ mariadb_root_password }}"
|
ROUNDCUBEMAIL_DEFAULT_HOST: "{{ roundcube_imap_host }}"
|
||||||
MYSQL_DATABASE: "{{ mariadb_database | default(omit) }}"
|
ROUNDCUBEMAIL_DEFAULT_PORT: "{{ roundcube_imap_port }}"
|
||||||
MYSQL_USER: "{{ mariadb_user | default(omit) }}"
|
ROUNDCUBEMAIL_SMTP_SERVER: "{{ roundcube_smtp_host }}"
|
||||||
MYSQL_PASSWORD: "{{ mariadb_password | default(omit) }}"
|
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:
|
networks:
|
||||||
- name: "{{ docker_network_name }}"
|
- name: "{{ docker_network_name }}"
|
||||||
ports:
|
ports:
|
||||||
- "{{ mariadb_bind_host }}:{{ mariadb_bind_port }}:3306"
|
|
||||||
|
|
||||||
- name: inspect mariadb volume
|
- 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
|
||||||
docker_volume_info:
|
docker_volume_info:
|
||||||
name: "{{ mariadb_volume }}"
|
name: "{{ roundcube_volume }}"
|
||||||
register: volinfo
|
register: volinfo
|
||||||
|
|
||||||
- name: export variables
|
- name: export variables
|
||||||
set_fact:
|
set_fact:
|
||||||
mariadb_container: "{{ lookup('vars','mariadb_container') }}"
|
roundcube_volume: "{{ lookup('vars','roundcube_volume') }}"
|
||||||
mariadb_volume: "{{ lookup('vars','mariadb_volume') }}"
|
roundcube_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
|
||||||
mariadb_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
|
|
||||||
mariadb_root_password: "{{ lookup('vars','mariadb_root_password') }}"
|
- name: allow self-signed mail server certs
|
||||||
mariadb_database: "{{ lookup('vars','mariadb_database',default=omit) }}"
|
blockinfile:
|
||||||
mariadb_user: "{{ lookup('vars','mariadb_user',default=omit) }}"
|
state: present
|
||||||
mariadb_password: "{{ lookup('vars','mariadb_password',default=omit) }}"
|
path: "{{ roundcube_volume_mountpoint }}/config/config.inc.php"
|
||||||
mariadb_host: localhost
|
block: |
|
||||||
mariadb_port: "{{ lookup('vars','mariadb_bind_port') }}"
|
$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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user