# SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev # SPDX-FileCopyrightText: 2022 MDAD project contributors # # SPDX-License-Identifier: AGPL-3.0-or-later --- - name: Fail if required Cinny settings not defined ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`) to use Cinny. when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - {'name': 'cinny_default_hs_url', when: true} - {'name': 'cinny_container_network', when: true} - {'name': 'cinny_container_labels_traefik_compression_middleware_name', when: "{{ cinny_container_labels_traefik_compression_middleware_enabled }}"} - name: (Deprecation) Catch and report renamed Cinny variables ansible.builtin.fail: msg: >- The variable `{{ item.old }}` is deprecated. Please use `{{ item.new }}` instead. when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" with_items: - {'old': 'cinny_container_image_name_prefix', 'new': 'cinny_container_image_registry_prefix'} - name: Fail if cinny_path_prefix is not / ansible.builtin.fail: msg: >- `cinny_path_prefix` is set to `{{ cinny_path_prefix }}` in your configuration, but Cinny no longer supports hosting under a path prefix without an application rebuild. Consider removing your `cinny_path_prefix` override and adjusting the Cinny hostname via `matrix_server_fqn_cinny` or `cinny_hostname`. See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/3701 when: "cinny_path_prefix != '/'" - when: cinny_container_labels_traefik_enabled | bool block: - name: Fail if required cinny Traefik settings not defined ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "lookup('vars', item, default='') == ''" with_items: - cinny_container_labels_traefik_hostname - cinny_container_labels_traefik_path_prefix # We ensure it doesn't end with a slash, because we handle both (slash and no-slash). # Knowing that `cinny_container_labels_traefik_path_prefix` does not end with a slash # ensures we know how to set these routes up without having to do "does it end with a slash" checks elsewhere. - name: Fail if cinny_container_labels_traefik_path_prefix ends with a slash ansible.builtin.fail: msg: >- cinny_container_labels_traefik_path_prefix (`{{ cinny_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/cinny`). when: "cinny_container_labels_traefik_path_prefix != '/' and cinny_container_labels_traefik_path_prefix[-1] == '/'"