From 0d6fc9b766a95231bd11dc43ec77deb6523e7f04 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 4 May 2026 22:07:22 +0300 Subject: [PATCH] matrix-client-commet: switch to modern community.docker docker_image modules Replaces `community.docker.docker_image` with the modern `docker_image_pull` module. Drops the `ansible_version` compatibility ladder and the now-redundant `_container_image_force_pull` variable (the new pull module handles registry refresh natively via `pull: always`). Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/5191. Co-Authored-By: Claude Opus 4.7 (1M context) --- roles/custom/matrix-client-commet/defaults/main.yml | 1 - roles/custom/matrix-client-commet/tasks/main.yml | 3 +++ .../matrix-client-commet/tasks/setup_install.yml | 6 ++---- .../matrix-client-commet/tasks/validate_config.yml | 12 ++++++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 roles/custom/matrix-client-commet/tasks/validate_config.yml 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)'}