Solved some bugs and optimized nextcloud

This commit is contained in:
2025-02-21 10:53:19 +01:00
parent a61fa3e614
commit 8afb2a3b84
10 changed files with 59 additions and 20 deletions

View File

@@ -0,0 +1,31 @@
- name: "Substitute http with https in {{ nextcloud_config_file_path }}"
replace:
path: "{{ nextcloud_config_file_path }}"
regexp: "http://{{ domain | regex_escape }}"
replace: "https://{{ domain }}"
notify:
- docker compose restart
- name: "Ensure 'overwriteprotocol' is set to 'https' in Nextcloud {{ nextcloud_config_file_path }}"
block:
- name: Check if 'overwriteprotocol' is already set
lineinfile:
path: "{{ nextcloud_config_file_path }}"
regexp: "^\s*'overwriteprotocol'\s*=>\s*'http'"
line: "'overwriteprotocol' => 'https',"
backrefs: yes
state: present
notify:
- docker compose restart
- name: Add 'overwriteprotocol' => 'https' if not present
lineinfile:
path: "{{ nextcloud_config_file_path }}"
regexp: "^\s*\);$"
line: "'overwriteprotocol' => 'https',"
insertafter: "^\s*\);$"
state: present
notify:
- docker compose restart
notify:
- docker compose restart

View File

@@ -6,18 +6,12 @@
- name: "include role for {{application_id}} to recieve certs & do modification routines"
include_role:
name: nginx-https-get-cert-modify-all
vars:
domain: "{{domains[application_id]}}"
http: "{{ ports.localhost.http[application_id] }}"
- name: create nextcloud nginx proxy configuration file
template:
src: "proxy-nginx.conf.j2"
dest: "{{nginx.directories.http.servers}}{{domains[application_id]}}.conf"
notify: restart nginx
vars:
domain: "{{domains[application_id]}}"
http_port: "{{ports.localhost.http[application_id]}}"
- name: create internal nextcloud nginx configuration
template:
@@ -34,4 +28,7 @@
- name: Include LDAP specific tasks
include_tasks: ldap.yml
when: applications[application_id].ldap_enabled | bool
when: applications[application_id].ldap_enabled | bool
- name: Include Config specific tasks
include_tasks: config.yml