Skip to content

Commit b91ce39

Browse files
spantaleevclaude
andcommitted
matrix-user-verification-service: switch to modern community.docker docker_image modules
Replaces `community.docker.docker_image` with the modern `docker_image_pull` and `docker_image_build` split modules. 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`). Also registers `_container_image_build_result` so that a self-build rebuild correctly triggers a service restart. Related to spantaleev#5191. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 78e86ca commit b91ce39

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

roles/custom/matrix-user-verification-service/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ matrix_user_verification_service_container_image: "{{ matrix_user_verification_s
3434
matrix_user_verification_service_container_image_registry_prefix: "{{ 'localhost/' if matrix_user_verification_service_container_image_self_build else matrix_user_verification_service_container_image_registry_prefix_upstream }}"
3535
matrix_user_verification_service_container_image_registry_prefix_upstream: "{{ matrix_user_verification_service_container_image_registry_prefix_upstream_default }}"
3636
matrix_user_verification_service_container_image_registry_prefix_upstream_default: "docker.io/"
37-
matrix_user_verification_service_container_image_force_pull: "{{ matrix_user_verification_service_container_image.endswith(':latest') }}"
3837

3938
# The base container network. It will be auto-created by this role if it doesn't exist already.
4039
matrix_user_verification_service_container_network: ""

roles/custom/matrix-user-verification-service/tasks/setup_install.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
when: item.when | bool
2020

2121
- name: Ensure Matrix User Verification Service image is pulled
22-
community.docker.docker_image:
22+
community.docker.docker_image_pull:
2323
name: "{{ matrix_user_verification_service_container_image }}"
24-
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
25-
force_source: "{{ matrix_user_verification_service_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
26-
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_user_verification_service_container_image_force_pull }}"
24+
pull: always
2725
register: matrix_user_verification_service_container_image_pull_result
2826
retries: "{{ devture_playbook_help_container_retries_count }}"
2927
delay: "{{ devture_playbook_help_container_retries_delay }}"
@@ -42,16 +40,14 @@
4240
when: "matrix_user_verification_service_container_image_self_build | bool"
4341

4442
- name: Ensure Matrix User Verification Service image is built
45-
community.docker.docker_image:
43+
community.docker.docker_image_build:
4644
name: "{{ matrix_user_verification_service_container_image }}"
47-
source: build
48-
force_source: "{{ matrix_user_verification_service_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
49-
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_user_verification_service_git_pull_results.changed }}"
50-
build:
51-
dockerfile: Dockerfile
52-
path: "{{ matrix_user_verification_service_container_src_files_path }}"
53-
pull: true
45+
dockerfile: Dockerfile
46+
path: "{{ matrix_user_verification_service_container_src_files_path }}"
47+
pull: true
48+
rebuild: "{{ 'always' if matrix_user_verification_service_git_pull_results.changed | bool else 'never' }}"
5449
when: "matrix_user_verification_service_container_image_self_build | bool"
50+
register: matrix_user_verification_service_container_image_build_result
5551

5652
- name: Ensure Matrix User Verification Service env file installed
5753
ansible.builtin.template:
@@ -83,4 +79,5 @@
8379
matrix_user_verification_service_config_result.changed | default(false)
8480
or matrix_user_verification_service_systemd_service_result.changed | default(false)
8581
or matrix_user_verification_service_container_image_pull_result.changed | default(false)
82+
or matrix_user_verification_service_container_image_build_result.changed | default(false)
8683
}}

roles/custom/matrix-user-verification-service/tasks/validate_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- {'old': 'matrix_user_verification_service_docker_image_registry_prefix_upstream', 'new': 'matrix_user_verification_service_container_image_registry_prefix_upstream'}
2020
- {'old': 'matrix_user_verification_service_docker_image_registry_prefix_upstream_default', 'new': 'matrix_user_verification_service_container_image_registry_prefix_upstream_default'}
2121
- {'old': 'matrix_user_verification_service_docker_src_files_path', 'new': 'matrix_user_verification_service_container_src_files_path'}
22+
- {'old': 'matrix_user_verification_service_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}
2223

2324
- name: Verify homeserver_url is not empty
2425
ansible.builtin.assert:

0 commit comments

Comments
 (0)