mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-05-19 20:38:02 +00:00
Modernise Draupnir Role ansible modules and update restart logic (#5187)
This commit is contained in:
@@ -38,11 +38,9 @@
|
||||
register: matrix_bot_draupnir_support_files_result
|
||||
|
||||
- name: Ensure Draupnir Docker image is pulled
|
||||
community.docker.docker_image:
|
||||
community.docker.docker_image_pull:
|
||||
name: "{{ matrix_bot_draupnir_container_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_draupnir_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_bot_draupnir_container_image_force_pull }}"
|
||||
pull: always
|
||||
when: "not matrix_bot_draupnir_container_image_self_build | bool"
|
||||
register: matrix_bot_draupnir_container_image_pull_result
|
||||
retries: "{{ devture_playbook_help_container_retries_count }}"
|
||||
@@ -61,15 +59,18 @@
|
||||
when: "matrix_bot_draupnir_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_bot_draupnir_container_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_bot_draupnir_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_bot_draupnir_container_src_files_path }}"
|
||||
pull: true
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_bot_draupnir_container_src_files_path }}"
|
||||
pull: true
|
||||
rebuild: "{{ 'always' if matrix_bot_draupnir_git_pull_results.changed | bool else 'never' }}"
|
||||
when: "matrix_bot_draupnir_container_image_self_build | bool"
|
||||
register: matrix_bot_draupnir_container_image_build_result
|
||||
|
||||
- name: Ensure matrix-bot-draupnir config installed
|
||||
ansible.builtin.copy:
|
||||
@@ -113,7 +114,8 @@
|
||||
or matrix_bot_draupnir_config_result.changed | default(false)
|
||||
or matrix_bot_draupnir_systemd_service_result.changed | default(false)
|
||||
or matrix_bot_draupnir_container_image_pull_result.changed | default(false)
|
||||
or matrix_bot_draupnir_container_image_force_pull | bool
|
||||
or matrix_bot_draupnir_container_image_build_result.changed | default(false)
|
||||
or matrix_bot_draupnir_force_restart | bool
|
||||
}}
|
||||
|
||||
- name: Ensure matrix-bot-draupnir.service restarted, if necessary
|
||||
|
||||
Reference in New Issue
Block a user