2021-10-24 13:50:32 +00:00
|
|
|
---
|
|
|
|
|
2021-11-26 06:55:46 +00:00
|
|
|
- name: Ensure {{ key }} is set to {{ '***' if ['pass', 'secret', 'key']|select('in', key) else value }}
|
2021-10-24 13:50:32 +00:00
|
|
|
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
|
2024-10-04 17:41:12 +00:00
|
|
|
until: nextcloud_current_config_entry is success
|
|
|
|
retries: 30
|
|
|
|
delay: 10
|
2021-11-26 06:54:54 +00:00
|
|
|
check_mode: false
|
2021-10-24 13:50:32 +00:00
|
|
|
changed_when: false
|
|
|
|
|
2021-11-26 06:55:46 +00:00
|
|
|
- name: Set {{ key }} to {{ '***' if (['pass', 'secret', 'key']|select('in', key)) else value }}
|
2021-10-24 13:50:32 +00:00
|
|
|
community.docker.docker_container_exec:
|
|
|
|
container: "{{ nextcloud_container_name }}"
|
2021-10-28 15:56:05 +00:00
|
|
|
command: "{{ nextcloud_occ_command }} config:{{ type }}:set {{ scope }} {{ entry }} --type={{ value_type }} --value={{ value }} -n"
|
2021-10-24 13:50:32 +00:00
|
|
|
user: "{{ nextcloud_user_info.uid }}"
|
|
|
|
tty: yes
|
|
|
|
when: nextcloud_current_config_entry.stdout != value
|
|
|
|
notify: restart-nextcloud
|
|
|
|
vars:
|
|
|
|
entry_path: "{{ key.split('.') }}"
|
2021-10-28 15:56:05 +00:00
|
|
|
value_type: >-
|
|
|
|
{% if value is boolean %}
|
|
|
|
boolean
|
|
|
|
{% elsif value is integer %}
|
|
|
|
integer
|
|
|
|
{% elsif value is float %}
|
|
|
|
float
|
|
|
|
{% else %}
|
|
|
|
string
|
|
|
|
{% endif %}
|
2021-10-24 13:50:32 +00:00
|
|
|
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(" "))
|
|
|
|
}}
|