feat(server): allow configuring nextcloud settings by populating nextcloud_extra_config

This commit is contained in:
2021-10-24 15:50:32 +02:00
parent feadc801d5
commit e9715e31bf
3 changed files with 50 additions and 37 deletions

View File

@ -0,0 +1,30 @@
---
- name: Ensure {{ key }} is set to {{ value }}
block:
- name: Check value of {{ key }}
community.docker.docker_container_exec:
container: "{{ nextcloud_container_name }}"
command: "{{ nextcloud_occ_command }} config:{{ type }}:get {{ scope }} {{ entry }}"
user: "{{ nextcloud_user_info.uid }}"
tty: yes
register: nextcloud_current_config_entry
changed_when: false
- name: Set {{ key }} to {{ value }}
community.docker.docker_container_exec:
container: "{{ nextcloud_container_name }}"
command: "{{ nextcloud_occ_command }} config:{{ type }}:set {{ scope }} {{ entry }} --value={{ value }} -n"
user: "{{ nextcloud_user_info.uid }}"
tty: yes
when: nextcloud_current_config_entry.stdout != value
notify: restart-nextcloud
vars:
entry_path: "{{ key.split('.') }}"
type: "{{ entry_path | first }}"
scope: "{{ entry_path[1] if entry_path | length > 2 else '' }}"
entry: >-
{{
entry_path[1] if entry_path|length == 2 else
(entry_path[2:] | join(" "))
}}