inicial nextcloud

This commit is contained in:
Mauro Torrez
2019-08-29 00:57:53 -03:00
parent ed73b0bc2e
commit 2610cd4ef1
2 changed files with 61 additions and 106 deletions

View File

@@ -1,86 +1,65 @@
---
# TODO: postgres support
# - name: create nextcloud database (pg)
# - name: create roundcube database (pg)
# postgresql_db:
# state: present
# name: "{{ nextcloud_db_name }}"
# name: "{{ roundcube_db_name }}"
# login_host: "{{ postgresql_host }}"
# login_port: "{{ postgresql_port }}"
# login_user: "{{ postgresql_root_password }}"
# login_password: "{{ postgresql_root_password }}"
# - name: create nextcloud db user (pg)
# - name: create roundcube db user (pg)
# postgresql_user:
# state: present
# name: "{{ nextcloud_db_user }}"
# password: "{{ nextcloud_db_password }}"
# priv: "{{ nextcloud_db_name }}.*:ALL"
# 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 nextcloud database
- name: create roundcube database
mysql_db:
state: present
name: "{{ nextcloud_db_name }}"
name: "{{ roundcube_db_name }}"
login_host: "{{ mariadb_host }}"
login_port: "{{ mariadb_port }}"
login_user: root
login_password: "{{ mariadb_root_password }}"
- name: create nextcloud db user
- name: create roundcube db user
mysql_user:
state: present
name: "{{ nextcloud_db_user }}"
name: "{{ roundcube_db_user }}"
host: "%"
password: "{{ nextcloud_db_password }}"
priv: "{{ nextcloud_db_name }}.*:ALL"
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 }}"
- name: start nextcloud container
- name: start roundcube container
docker_container:
image: "{{ nextcloud_image }}"
name: "{{ nextcloud_container }}"
image: "{{ roundcube_image }}"
name: "{{ roundcube_container }}"
volumes:
- "{{ nextcloud_volume }}:/var/www/html"
- "{{ roundcube_volume }}:/var/www/html"
env:
SQLITE_DATABASE:
"{{ nextcloud_db_name if nextcloud_db_engine == 'sqlite' else '' }}"
MYSQL_DATABASE:
"{{ nextcloud_db_name if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
MYSQL_USER:
"{{ nextcloud_db_user if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
MYSQL_PASSWORD:
"{{ nextcloud_db_password if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
MYSQL_HOST:
"{{ nextcloud_db_host if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
POSTGRES_DB:
"{{ nextcloud_db_name if 'postgres' in nextcloud_db_engine else '' }}"
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 }}"
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 }}"
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:
@@ -89,13 +68,13 @@
copy:
content: |
location {{ nextcloud_web_root }} {
location {{ roundcube_web_root }} {
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://{{ nextcloud_container }};
proxy_pass http://{{ roundcube_container }};
}
dest: "{{ nginx_location_mountpoint }}/nextcloud.conf"
dest: "{{ nginx_location_mountpoint }}/roundcube.conf"
register: ngconf
- name: restart frontend
@@ -104,12 +83,12 @@
restart: yes
when: ngconf is changed
- name: inspect nextcloud volume
- name: inspect roundcube volume
docker_volume_info:
name: "{{ nextcloud_volume }}"
name: "{{ roundcube_volume }}"
register: volinfo
- name: export variables
set_fact:
nextcloud_volume: "{{ lookup('vars','nextcloud_volume') }}"
nextcloud_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
roundcube_volume: "{{ lookup('vars','roundcube_volume') }}"
roundcube_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"