diff --git a/roles/custom/matrix-client-commet/defaults/main.yml b/roles/custom/matrix-client-commet/defaults/main.yml index 37e604a22..17ba27b7e 100644 --- a/roles/custom/matrix-client-commet/defaults/main.yml +++ b/roles/custom/matrix-client-commet/defaults/main.yml @@ -30,7 +30,6 @@ matrix_client_commet_container_image_self_build_repo: "https://github.com/commet matrix_client_commet_container_image_self_build_git_hash: "" matrix_client_commet_container_image_self_build_version_tag: "{{ matrix_client_commet_version }}" matrix_client_commet_container_image: "localhost/matrix-client-commet:{{ matrix_client_commet_version }}" -matrix_client_commet_container_image_force_pull: "{{ matrix_client_commet_container_image.endswith(':latest') or matrix_client_commet_container_image.endswith(':main') }}" # The in-container port nginx listens on matrix_client_commet_container_port: 8080 diff --git a/roles/custom/matrix-client-commet/tasks/main.yml b/roles/custom/matrix-client-commet/tasks/main.yml index c5a421018..488c474da 100644 --- a/roles/custom/matrix-client-commet/tasks/main.yml +++ b/roles/custom/matrix-client-commet/tasks/main.yml @@ -10,6 +10,9 @@ - install-all - install-client-commet block: + - when: matrix_client_commet_enabled | bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" + - when: matrix_client_commet_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" diff --git a/roles/custom/matrix-client-commet/tasks/setup_install.yml b/roles/custom/matrix-client-commet/tasks/setup_install.yml index 07b44e15d..e5900d7e6 100644 --- a/roles/custom/matrix-client-commet/tasks/setup_install.yml +++ b/roles/custom/matrix-client-commet/tasks/setup_install.yml @@ -17,11 +17,9 @@ - "{{ matrix_client_commet_config_path }}" - name: Ensure Commet container image is pulled - community.docker.docker_image: + community.docker.docker_image_pull: name: "{{ matrix_client_commet_container_image }}" - source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" - force_source: "{{ matrix_client_commet_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" - force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_client_commet_container_image_force_pull }}" + pull: always when: "not matrix_client_commet_container_image_self_build | bool" register: matrix_client_commet_image_pull_result retries: "{{ devture_playbook_help_container_retries_count }}" diff --git a/roles/custom/matrix-client-commet/tasks/validate_config.yml b/roles/custom/matrix-client-commet/tasks/validate_config.yml new file mode 100644 index 000000000..c32eb165d --- /dev/null +++ b/roles/custom/matrix-client-commet/tasks/validate_config.yml @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: 2026 MDAD project contributors +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +--- +- name: (Deprecation) Catch and report renamed matrix-client-commet 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_client_commet_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'}