Files
matrix-docker-ansible-deploy/roles/custom/matrix-matrixto/tasks/validate_config.yml
T
Slavi Pantaleev 9d89b317f8 matrix-matrixto: switch to modern community.docker docker_image modules
Replaces `community.docker.docker_image` with the modern
`docker_image_build` module. Drops the `ansible_version` compatibility
ladder.

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/5191.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 22:17:09 +03:00

52 lines
2.6 KiB
YAML

# SPDX-FileCopyrightText: 2023 Slavi Pantaleev
# SPDX-FileCopyrightText: 2025 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Fail if required Matrix.to settings not defined
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`).
when: "lookup('vars', item, default='') | string | length == 0"
with_items:
- matrix_matrixto_hostname
- matrix_matrixto_path_prefix
- matrix_matrixto_container_network
- name: Run if Traefik is enabled
when: matrix_matrixto_container_labels_traefik_enabled | bool
block:
- name: Fail if Traefik settings required for Matrix.to are not defined
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`).
when: "lookup('vars', item, default='') | string | length == 0"
with_items:
- matrix_matrixto_container_labels_traefik_hostname
- matrix_matrixto_container_labels_traefik_path_prefix
- name: Fail if matrix_matrixto_container_labels_traefik_path_prefix is different than /
ansible.builtin.fail:
msg: >-
matrix_matrixto_container_labels_traefik_path_prefix (`{{ matrix_matrixto_container_labels_traefik_path_prefix }}`) must be `/`.
Matrix.to does not support hosting under a subpath yet.
when: "matrix_matrixto_container_labels_traefik_path_prefix != '/'"
# We ensure it doesn't end with a slash, because we handle both (slash and no-slash).
# Knowing that `matrix_matrixto_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 matrix_matrixto_container_labels_traefik_path_prefix ends with a slash
ansible.builtin.fail:
msg: >-
matrix_matrixto_container_labels_traefik_path_prefix (`{{ matrix_matrixto_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/matrixto`).
when: "matrix_matrixto_container_labels_traefik_path_prefix != '/' and matrix_matrixto_container_labels_traefik_path_prefix[-1] == '/'"
- name: (Deprecation) Catch and report renamed Matrix.to 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': 'matrix_matrixto_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}