From 2610cd4ef1907cb6be0291561611a570d37e77bc Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Thu, 29 Aug 2019 00:57:53 -0300 Subject: [PATCH] inicial nextcloud --- defaults/main.yml | 76 ++++++++++++++------------------------- tasks/main.yml | 91 ++++++++++++++++++----------------------------- 2 files changed, 61 insertions(+), 106 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 464c6a1..1f2826c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,57 +1,33 @@ --- # domain, webroot -nextcloud_domain: example.com -nextcloud_web_root: / - -# 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: "" - -# 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: "" +roundcube_domain: example.com +roundcube_web_root: / # container -nextcloud_image: nextcloud -nextcloud_container: nextcloud -nextcloud_volume: nextcloud +roundcube_image: roundcube +roundcube_container: roundcube +roundcube_volume: roundcube + +# mysql, mariadb, postgresql +roundcube_db_type: sqlite +roundcube_db_host: localhost +roundcube_db_user: roundcube +roundcube_db_password: password + +# data dir (inside container) +roundcube_data_dir: /var/www/html + +# imap +roundcube_imap_host: "" +roundcube_imap_port: "" + +# smtp +roundcube_smtp_host: "" +roundcube_smtp_port: "" +roundcube_smtp_user: "" +roundcube_smtp_password: "" +roundcube_mail_from_address: "" +roundcube_mail_domain: "" # definido por rol docker docker_network_name: dockernet diff --git a/tasks/main.yml b/tasks/main.yml index b5bafe0..1559cb3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 }}"