Compare commits

..

18 Commits

Author SHA1 Message Date
Mauro Torrez
aef469fa91 use postfix submission 2019-10-02 20:58:44 -03:00
Mauro Torrez
35cd435135 use tls by default for connecting to mail server 2019-10-02 19:02:27 -03:00
Mauro Torrez
769c69f166 Merge branch 'master' of https://git.mau.ro/mauro/ansible-role-roundcube-docker 2019-10-02 16:20:14 -03:00
Mauro Torrez
9f8f664ed7 roundcube version 2019-10-02 16:20:05 -03:00
33eda44c16 recursive combine 2019-10-02 13:14:05 +00:00
Mauro Torrez
23aba0b59e dont use tls - breaks serving static files 2019-10-02 01:22:18 -03:00
Mauro Torrez
188f7f87ac allow self-signed certs on mail server 2019-10-02 00:49:40 -03:00
Mauro Torrez
1378d4d677 tls support 2019-10-02 00:09:03 -03:00
Mauro Torrez
9fbe0c3a20 default connection parameters 2019-10-01 23:16:24 -03:00
Mauro Torrez
18fb1c7445 add trailing slash to location 2019-10-01 23:12:23 -03:00
Mauro Torrez
d66cd019d6 use eumau/roundcube image + nginx auto config 2019-10-01 22:52:37 -03:00
Mauro Torrez
e5507857df proxy redirect 2019-09-06 01:16:30 -03:00
Mauro Torrez
d8ce72e9d1 fix meta tag 2019-09-06 01:03:08 -03:00
Mauro Torrez
5d36d9edc5 netter nging location definition 2019-09-06 00:44:48 -03:00
Mauro Torrez
a9ff4f484b fix docker image name 2019-09-05 23:48:15 -03:00
Mauro Torrez
4c6f2f31da create mysql db only if required 2019-09-05 23:45:18 -03:00
Mauro Torrez
b049fb68a9 roundcube 2019-09-05 23:36:23 -03:00
Mauro Torrez
2610cd4ef1 inicial nextcloud 2019-08-29 00:57:53 -03:00
2 changed files with 90 additions and 158 deletions

View File

@ -1,82 +1,39 @@
--- ---
# domain, webroot # domain, webroot
nextcloud_domain: example.com roundcube_domain: default
nextcloud_web_root: / roundcube_web_root: /roundcube
roundcube_version: 1.3.10
# database
nextcloud_db_engine: sqlite
# db name or path (sqlite)
nextcloud_db_name: nextcloud
# mysql, mariadb, postgresql
nextcloud_db_host: localhost
nextcloud_db_user: nextcloud
nextcloud_db_password: password
nextcloud_table_prefix: ""
# data dir (inside container)
nextcloud_data_dir: /var/www/html/data
# admin user
nextcloud_admin_user: admin
nextcloud_admin_password: password
# space separated trusted domains
nextcloud_trusted_domains:
- "{{ nextcloud_domain }}"
# The install and update script is only triggered when a default command
# is used (apache-foreground or php-fpm). If you use a custom command
# you have to enable the install / update with
nextcloud_update: ""
# The use of Redis is recommended to prevent file locking problems. See
# the examples for further instructions.
# If you want to use Redis you have to create a separate Redis container
# in your setup / in your docker-compose file. To inform Nextcloud about
# the Redis container add:
nextcloud_redis_host: ""
nextcloud_redis_port: "6379"
# smtp
nextcloud_smtp_host: ""
nextcloud_smtp_secure: ""
nextcloud_smtp_port: ""
nextcloud_smtp_authtype: LOGIN
nextcloud_smtp_user: ""
nextcloud_smtp_password: ""
nextcloud_mail_from_address: ""
nextcloud_mail_domain: "{{ nextcloud_domain }}"
# ldap
nextcloud_ldap_enable: false
nextcloud_ldap_host: "{{ ldap_uri | default('openldap') | regex_replace(':[0-9]+$') }}"
nextcloud_ldap_port: "389"
#nextcloud_ldap_backup_host: ""
nextcloud_ldap_backup_port: "389"
#nextcloud_ldap_agent_name: ""
#nextcloud_ldap_agent_password: ""
nextcloud_ldap_base: "dc={{ openldap_domain | default('example.com') | replace('.', ',dc=') }}"
#nextcloud_ldap_base_users: ""
#nextcloud_ldap_base_groups: ""
#nextcloud_ldap_user_filter_objectclass: ""
#nextcloud_ldap_user_filter: ""
#nextcloud_ldap_login_filter: ""
#nextcloud_ldap_group_filter_objectclass: ""
#nextcloud_ldap_group_filter: ""
#nextcloud_ldap_gid_number: ""
#nextcloud_ldap_user_display_name: ""
#nextcloud_ldap_user_display_name_2: ""
#nextcloud_ldap_group_display_name: ""
#nextcloud_ldap_email_attribute: ""
#nextcloud_ldap_group_member_assoc_attr: ""
#nextcloud_ldap_expert_username_attr: ""
# container # container
nextcloud_image: eumau/nextcloud roundcube_image: eumau/roundcubemail:{{ roundcube_version }}
nextcloud_container: nextcloud roundcube_container: roundcube
nextcloud_volume: nextcloud roundcube_volume: roundcube
# 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 '' }}
# data dir (inside container)
roundcube_data_dir: /var/www/html
# 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
# definido por rol docker # definido por rol docker
docker_network: dockernet docker_network_name: dockernet

View File

@ -1,133 +1,108 @@
--- ---
# TODO: postgres support # TODO: postgres support
# - name: create nextcloud database (pg) # - name: create roundcube database (pg)
# postgresql_db: # postgresql_db:
# state: present # state: present
# name: "{{ nextcloud_db_name }}" # name: "{{ roundcube_db_name }}"
# login_host: "{{ postgresql_host }}" # login_host: "{{ postgresql_host }}"
# login_port: "{{ postgresql_port }}" # login_port: "{{ postgresql_port }}"
# login_user: "{{ postgresql_root_password }}" # login_user: "{{ postgresql_root_password }}"
# login_password: "{{ postgresql_root_password }}" # login_password: "{{ postgresql_root_password }}"
# - name: create nextcloud db user (pg) # - name: create roundcube db user (pg)
# postgresql_user: # postgresql_user:
# state: present # state: present
# name: "{{ nextcloud_db_user }}" # name: "{{ roundcube_db_user }}"
# password: "{{ nextcloud_db_password }}" # password: "{{ roundcube_db_password }}"
# priv: "{{ nextcloud_db_name }}.*:ALL" # priv: "{{ roundcube_db_name }}.*:ALL"
# login_host: "{{ postgresql_host }}" # login_host: "{{ postgresql_host }}"
# login_port: "{{ postgresql_port }}" # login_port: "{{ postgresql_port }}"
# login_user: root # login_user: root
# login_password: "{{ postgresql_root_password }}" # login_password: "{{ postgresql_root_password }}"
- name: create nextcloud database - name: create roundcube database
mysql_db: mysql_db:
state: present state: present
name: "{{ nextcloud_db_name }}" name: "{{ roundcube_db_name }}"
login_host: "{{ mariadb_host }}" login_host: "{{ mariadb_host }}"
login_port: "{{ mariadb_port }}" login_port: "{{ mariadb_port }}"
login_user: root login_user: root
login_password: "{{ mariadb_root_password }}" login_password: "{{ mariadb_root_password }}"
when: nextcloud_db_engine in ('mariadb','mysql') when: roundcube_db_type in ('mariadb','mysql')
- name: create nextcloud db user - name: create roundcube db user
mysql_user: mysql_user:
state: present state: present
name: "{{ nextcloud_db_user }}" name: "{{ roundcube_db_user }}"
host: "%" host: "%"
password: "{{ nextcloud_db_password }}" password: "{{ roundcube_db_password }}"
priv: "{{ nextcloud_db_name }}.*:ALL" priv: "{{ roundcube_db_name }}.*:ALL"
login_host: "{{ mariadb_host }}" login_host: "{{ mariadb_host }}"
login_port: "{{ mariadb_port }}" login_port: "{{ mariadb_port }}"
login_user: root login_user: root
login_password: "{{ mariadb_root_password }}" login_password: "{{ mariadb_root_password }}"
when: nextcloud_db_engine in ('mariadb','mysql') when: roundcube_db_type in ('mariadb','mysql')
- name: start nextcloud container - name: start roundcube container
docker_container: docker_container:
image: "{{ nextcloud_image }}" image: "{{ roundcube_image }}"
name: "{{ nextcloud_container }}" name: "{{ roundcube_container }}"
volumes: volumes:
- "{{ nextcloud_volume }}:/var/www/html" - "{{ roundcube_volume }}:/var/www/html"
env: env:
SQLITE_DATABASE: ROUNDCUBEMAIL_DEFAULT_HOST: "{{ roundcube_imap_host }}"
"{{ nextcloud_db_name if nextcloud_db_engine == 'sqlite' else '' }}" ROUNDCUBEMAIL_DEFAULT_PORT: "{{ roundcube_imap_port }}"
MYSQL_DATABASE: ROUNDCUBEMAIL_SMTP_SERVER: "{{ roundcube_smtp_host }}"
"{{ nextcloud_db_name if nextcloud_db_engine in ('mysql','mariadb') else '' }}" ROUNDCUBEMAIL_SMTP_PORT: "{{ roundcube_smtp_port }}"
MYSQL_USER: ROUNDCUBEMAIL_PLUGINS: "{{ roundcube_plugins | join (',') }}"
"{{ nextcloud_db_user if nextcloud_db_engine in ('mysql','mariadb') else '' }}" ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE: "{{ roundcube_upload_max_filesize }}"
MYSQL_PASSWORD: ROUNDCUBEMAIL_DB_TYPE: "{{ roundcube_db_type }}"
"{{ nextcloud_db_password if nextcloud_db_engine in ('mysql','mariadb') else '' }}" ROUNDCUBEMAIL_DB_HOST: "{{ roundcube_db_host }}"
MYSQL_HOST: ROUNDCUBEMAIL_DB_PORT: "{{ roundcube_db_port }}"
"{{ nextcloud_db_host if nextcloud_db_engine in ('mysql','mariadb') else '' }}" ROUNDCUBEMAIL_DB_USER: "{{ roundcube_db_user }}"
POSTGRES_DB: ROUNDCUBEMAIL_DB_PASSWORD: "{{ roundcube_db_password }}"
"{{ nextcloud_db_name if 'postgres' in nextcloud_db_engine else '' }}" ROUNDCUBEMAIL_DB_NAME: "{{ roundcube_db_name }}"
POSTGRES_USER:
"{{ nextcloud_db_user if 'postgres' in nextcloud_db_engine else '' }}"
POSTGRES_PASSWORD:
"{{ nextcloud_db_password if 'postgres' in nextcloud_db_engine else '' }}"
POSTGRES_HOST:
"{{ nextcloud_db_host if 'postgres' in nextcloud_db_engine else '' }}"
NEXTCLOUD_TABLE_PREFIX: "{{ nextcloud_table_prefix }}"
NEXTCLOUD_ADMIN_USER: "{{ nextcloud_admin_user }}"
NEXTCLOUD_ADMIN_PASSWORD: "{{ nextcloud_admin_password }}"
NEXTCLOUD_TRUSTED_DOMAINS: "{{ nextcloud_trusted_domains | join(' ')}}"
NEXTCLOUD_UPDATE: "{{ nextcloud_update }}"
REDIS_HOST: "{{ nextcloud_redis_host }}"
REDIS_HOST_PORT: "{{ nextcloud_redis_port }}"
SMTP_HOST: "{{ nextcloud_smtp_host }}"
SMTP_SECURE: "{{ nextcloud_smtp_secure }}"
SMTP_PORT: "{{ nextcloud_smtp_port }}"
SMTP_AUTHTYPE: "{{ nextcloud_smtp_authtype }}"
SMTP_NAME: "{{ nextcloud_smtp_user }}"
SMTP_PASSWORD: "{{ nextcloud_smtp_password }}"
MAIL_FROM_ADDRESS: "{{ nextcloud_mail_from_address }}"
MAIL_DOMAIN: "{{ nextcloud_mail_domain }}"
LDAP_ENABLE: "{{ 'true' if nextcloud_ldap_enable else 'false' }}"
LDAP_HOST: "{{ nextcloud_ldap_host }}"
LDAP_PORT: "{{ nextcloud_ldap_port | string }}"
LDAP_BACKUP_HOST: "{{ nextcloud_ldap_backup_host | default(omit) }}"
LDAP_BACKUP_PORT: "{{ nextcloud_ldap_backup_port | string }}"
LDAP_AGENT_NAME: "{{ nextcloud_ldap_agent_name | default(omit) }}"
LDAP_AGENT_PASSWORD: "{{ nextcloud_ldap_agent_password | default(omit) }}"
LDAP_BASE: "{{ nextcloud_ldap_base }}"
LDAP_BASE_USERS: "{{ nextcloud_ldap_base_users | default(omit) }}"
LDAP_BASE_GROUPS: "{{ nextcloud_ldap_base_groups | default(omit) }}"
LDAP_USER_FILTER_OBJECTCLASS: "{{ nextcloud_ldap_user_filter_objectclass | default(omit) }}"
LDAP_USER_FILTER: "{{ nextcloud_ldap_user_filter | default(omit) }}"
LDAP_LOGIN_FILTER: "{{ nextcloud_ldap_login_filter | default(omit) }}"
LDAP_GROUP_FILTER_OBJECTCLASS: "{{ nextcloud_ldap_group_filter_objectclass | default(omit) }}"
LDAP_GROUP_FILTER: "{{ nextcloud_ldap_group_filter | default(omit) }}"
LDAP_GID_NUMBER: "{{ nextcloud_ldap_gid_number | default(omit) }}"
LDAP_USER_DISPLAY_NAME: "{{ nextcloud_ldap_user_display_name | default(omit) }}"
LDAP_USER_DISPLAY_NAME_2: "{{ nextcloud_ldap_user_display_name_2 | default(omit) }}"
LDAP_GROUP_DISPLAY_NAME: "{{ nextcloud_ldap_group_display_name | default(omit) }}"
LDAP_EMAIL_ATTRIBUTE: "{{ nextcloud_ldap_email_attribute | default(omit) }}"
LDAP_GROUP_MEMBER_ASSOC_ATTR: "{{ nextcloud_ldap_group_member_assoc_attr | default(omit) }}"
LDAP_EXPERT_USERNAME_ATTR: "{{ nextcloud_ldap_expert_username_attr | default(omit) }}"
networks: networks:
- name: "{{ docker_network }}" - name: "{{ docker_network_name }}"
ports: ports:
- name: export nginx config - name: export nginx config
set_fact: set_fact:
nginx_config: >- nginx_config: >-
{{ nginx_config | default({}) | combine({ {{ nginx_config | default({}) | combine({
nextcloud_domain: { roundcube_domain: {
"locations": { "locations": {
'/': { roundcube_web_root.rstrip('/')+'/': {
"proxy_pass": "https://{}:9010".format(nextcloud_container) "proxy_pass": "http://{}:9080/".format(roundcube_container)
}
} }
} }
}
}, recursive=True) }} }, recursive=True) }}
- name: inspect nextcloud volume - name: inspect roundcube volume
docker_volume_info: docker_volume_info:
name: "{{ nextcloud_volume }}" name: "{{ roundcube_volume }}"
register: volinfo register: volinfo
- name: export variables - name: export variables
set_fact: set_fact:
nextcloud_volume: "{{ lookup('vars','nextcloud_volume') }}" roundcube_volume: "{{ lookup('vars','roundcube_volume') }}"
nextcloud_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}" 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,
),
);