mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-05-21 13:28:02 +00:00
Modernise Draupnir Role ansible modules and update restart logic (#5187)
This commit is contained in:
@@ -26,11 +26,9 @@
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure Draupnir Docker image is pulled
|
||||
community.docker.docker_image:
|
||||
community.docker.docker_image_pull:
|
||||
name: "{{ matrix_appservice_draupnir_for_all_container_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_draupnir_for_all_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_appservice_draupnir_for_all_container_image_force_pull }}"
|
||||
pull: always
|
||||
when: "not matrix_appservice_draupnir_for_all_container_image_self_build | bool"
|
||||
register: matrix_appservice_draupnir_for_all_container_image_pull_result
|
||||
retries: "{{ devture_playbook_help_container_retries_count }}"
|
||||
@@ -49,15 +47,18 @@
|
||||
when: "matrix_appservice_draupnir_for_all_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure Draupnir Docker image is built
|
||||
community.docker.docker_image:
|
||||
# Using docker_image_build with BuildKit for modern, efficient builds.
|
||||
# Rebuild when the git checkout advanced to a new commit; otherwise keep the build idempotent.
|
||||
# Technically the idempotency of rebuilds is more that if a build has already been executed for that name:tag
|
||||
# then we won't rebuild while in idempotent mode even if git moved. That's what the force rebuild logic is for.
|
||||
community.docker.docker_image_build:
|
||||
name: "{{ matrix_appservice_draupnir_for_all_container_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_appservice_draupnir_for_all_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_appservice_draupnir_for_all_container_src_files_path }}"
|
||||
pull: true
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_appservice_draupnir_for_all_container_src_files_path }}"
|
||||
pull: true
|
||||
rebuild: "{{ 'always' if matrix_appservice_draupnir_for_all_git_pull_results.changed | bool else 'never' }}"
|
||||
when: "matrix_appservice_draupnir_for_all_container_image_self_build | bool"
|
||||
register: matrix_appservice_draupnir_for_all_container_image_build_result
|
||||
|
||||
- name: Ensure matrix-appservice-draupnir-for-all appservice config installed
|
||||
ansible.builtin.copy:
|
||||
@@ -120,7 +121,8 @@
|
||||
or matrix_appservice_draupnir_for_all_registration_config_result.changed | default(false)
|
||||
or matrix_appservice_draupnir_for_all_systemd_service_result.changed | default(false)
|
||||
or matrix_appservice_draupnir_for_all_container_image_pull_result.changed | default(false)
|
||||
or matrix_appservice_draupnir_for_all_container_image_force_pull | bool
|
||||
or matrix_appservice_draupnir_for_all_container_image_build_result.changed | default(false)
|
||||
or matrix_appservice_draupnir_for_all_force_restart | bool
|
||||
}}
|
||||
|
||||
- name: Ensure matrix-appservice-draupnir-for-all.service restarted, if necessary
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
- {'old': 'matrix_appservice_draupnir_for_all_docker_image_registry_prefix_upstream', 'new': 'matrix_appservice_draupnir_for_all_container_image_registry_prefix_upstream'}
|
||||
- {'old': 'matrix_appservice_draupnir_for_all_docker_image_registry_prefix_upstream_default', 'new': 'matrix_appservice_draupnir_for_all_container_image_registry_prefix_upstream_default'}
|
||||
- {'old': 'matrix_appservice_draupnir_for_all_docker_src_files_path', 'new': 'matrix_appservice_draupnir_for_all_container_src_files_path'}
|
||||
- {'old': 'matrix_appservice_draupnir_for_all_container_image_force_pull', 'new': '<removed> (No longer needed due to new docker module doing this natively only if needed.)'}
|
||||
|
||||
- name: Fail if required matrix-bot-draupnir variables are undefined
|
||||
ansible.builtin.fail:
|
||||
|
||||
Reference in New Issue
Block a user