chore(keycloak): rebuild image if upstream image or buildfile changed, restart if image changed
This commit is contained in:
parent
c83ae1c122
commit
059443b09f
|
@ -25,6 +25,7 @@
|
|||
name: "{{ keycloak_container_upstream_image_name }}:{{ keycloak_version }}"
|
||||
source: pull
|
||||
state: present
|
||||
register: keycloak_container_image_upstream_status
|
||||
|
||||
- name: Ensure custom keycloak container image '{{ keycloak_container_image_name }}' is built
|
||||
community.docker.docker_image:
|
||||
|
@ -37,6 +38,8 @@
|
|||
path: "{{ keycloak_container_build_directory }}"
|
||||
source: build
|
||||
state: present
|
||||
force_source: "{{ keycloak_buildfile_info.changed or keycloak_container_image_upstream_status.changed or (keycloak_force_rebuild_container | default(false))}}"
|
||||
register: keycloak_container_image_status
|
||||
|
||||
- name: Ensure keycloak container is running
|
||||
community.docker.docker_container:
|
||||
|
@ -46,6 +49,7 @@
|
|||
labels: "{{ keycloak_container_labels | default(omit, true) }}"
|
||||
volumes: "{{ keycloak_container_volumes | default(omit, true) }}"
|
||||
restart_policy: "{{ keycloak_container_restart_policy }}"
|
||||
recreate: "{{ keycloak_container_image_status.changed if keycloak_container_image_status else false }}"
|
||||
state: started
|
||||
command: >-2
|
||||
start
|
||||
|
|
Reference in a new issue