From 88d2432cf66b88d349791b36c4a9938654fef7e1 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 10 Jan 2022 23:14:38 +0100 Subject: [PATCH] More config options. nginx aliases. --- defaults/main.yml | 4 ++++ tasks/nextcloud-config.yml | 18 ++++++++++++++++++ templates/nginx-virthost.conf.j2 | 2 +- vars/main.yml | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index d4f592d..1fcc590 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,6 +6,7 @@ nextcloud_release_channel: 'releases' nextcloud_get_latest_stable: True nextcloud_user: nextcloud nextcloud_timezone: 'Europe/Rome' +nextcloud_default_phone_region: 'IT' nextcloud_redis_cache_enabled: True nextcloud_local_redis: '{{ nextcloud_redis_cache_enabled }}' nextcloud_redis_params: @@ -45,10 +46,13 @@ nextcloud_log_rotation: 52 nextcloud_audit_log_enabled: True nextcloud_encryption_enabled: True nextcloud_servername: '{{ ansible_fqdn }}' +nextcloud_nginx_aliases: '{{ nextcloud_servername }}' nextcloud_servernames: - { webroot: '{{ nextcloud_web_root }}', id: 1, name: '{{ nextcloud_servername }}' } nextcloud_trusted_proxies: [] # - { proxy_ip: '127.0.0.1/8', proxy_id: 0 } +nextcloud_http_protocol: 'https' +nextcloud_cli_url: 'http://localhost' nextcloud_db: pgsql nextcloud_db_host: localhost nextcloud_db_name: nextcloud diff --git a/tasks/nextcloud-config.yml b/tasks/nextcloud-config.yml index f78dd7f..bbd2b4e 100644 --- a/tasks/nextcloud-config.yml +++ b/tasks/nextcloud-config.yml @@ -36,6 +36,24 @@ chdir: '{{ nextcloud_web_root }}' with_items: '{{ nextcloud_trusted_proxies }}' + - name: Overwrite the http protocol + shell: > + php occ config:system:set overwriteprotocol --value={{ nextcloud_http_protocol }} + args: + chdir: '{{ nextcloud_web_root }}' + + - name: Overwrite the CLI URL + shell: > + php occ config:system:set overwrite.cli.url --value={{ nextcloud_cli_url }} + args: + chdir: '{{ nextcloud_web_root }}' + + - name: Set the default phone region + shell: > + php occ config:system:set default_phone_region --value={{ nextcloud_default_phone_region }} + args: + chdir: '{{ nextcloud_web_root }}' + - name: Setup the email configuration with SMTP shell: > php occ config:system:set {{ item.name }} --value={{ item.id }} diff --git a/templates/nginx-virthost.conf.j2 b/templates/nginx-virthost.conf.j2 index baf3ce3..5938850 100644 --- a/templates/nginx-virthost.conf.j2 +++ b/templates/nginx-virthost.conf.j2 @@ -24,7 +24,7 @@ server { server { listen {% if item.https_port is defined %} {{ item.https_port }} {% else %} {{ https_port | default('443') }} {% endif %} ssl {% if ansible_distribution_release != "trusty" %} http2{% endif %}; - server_name {{ item.nginx_servername }}; + server_name {{ item.nginx_servername }} {{ item.nginx_aliases }}; include /etc/nginx/snippets/nginx-server-ssl.conf; server_tokens off; diff --git a/vars/main.yml b/vars/main.yml index 4380223..37e979e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -87,5 +87,5 @@ nextcloud_phpfpm_pools: req_term_timeout: '240s' virthost: '{{ nextcloud_servername }}' nginx_servername: '{{ nextcloud_servername }}' - + nginx_aliases: '{{ nextcloud_nginx_aliases }}'