Fix upgrade of docker-registry and opensm containers
Previously the docker-registry container would not be upgraded when a new image is downloaded. We now ensure that new images are tagged in the local repository, and pull the image separately from the container upgrade.
This commit is contained in:
parent
6f21f506c8
commit
943a4cdb66
@ -22,8 +22,10 @@ docker_registry_port: 5000
|
||||
####################
|
||||
# Docker
|
||||
####################
|
||||
docker_registry_namespace: "library"
|
||||
docker_registry_image: "{{ docker_registry ~ '/' if docker_registry | default else '' }}{{ docker_registry_namespace }}/registry"
|
||||
# NOTE: Namespace 'library' causes image task to always be changed and
|
||||
# container to never update to new images.
|
||||
docker_registry_namespace: ""
|
||||
docker_registry_image: "{{ docker_registry ~ '/' if docker_registry | default else '' }}{{ docker_registry_namespace ~ '/' if docker_registry_namespace else '' }}registry"
|
||||
docker_registry_tag: "latest"
|
||||
docker_registry_image_full: "{{ docker_registry_image }}:{{ docker_registry_tag }}"
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
name: "{{ item.value.container_name }}"
|
||||
ports: "{{ item.value.ports | default(omit) }}"
|
||||
privileged: "{{ item.value.privileged | default(omit) }}"
|
||||
pull: "{{ action == 'upgrade' }}"
|
||||
read_only: "{{ item.value.read_only | default(omit) }}"
|
||||
restart_policy: "{{ docker_registry_restart_policy }}"
|
||||
restart_retries: "{{ docker_registry_restart_retries }}"
|
||||
|
@ -2,4 +2,5 @@
|
||||
- name: Pulling Docker registry container image
|
||||
docker_image:
|
||||
name: "{{ docker_registry_image_full }}"
|
||||
repository: "{{ docker_registry_image_full }}"
|
||||
state: present
|
||||
|
@ -1 +0,0 @@
|
||||
deploy.yml
|
3
ansible/roles/docker-registry/tasks/upgrade.yml
Normal file
3
ansible/roles/docker-registry/tasks/upgrade.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- include: pull.yml
|
||||
- include: deploy.yml
|
@ -5,7 +5,6 @@
|
||||
name: "{{ item.value.container_name }}"
|
||||
network_mode: "host"
|
||||
privileged: "{{ item.value.privileged | default(omit) }}"
|
||||
pull: "{{ action == 'upgrade' }}"
|
||||
read_only: "{{ item.value.read_only | default(omit) }}"
|
||||
restart_policy: "{{ opensm_restart_policy }}"
|
||||
restart_retries: "{{ opensm_restart_retries }}"
|
||||
|
@ -2,4 +2,5 @@
|
||||
- name: Pulling OpenSM container image
|
||||
docker_image:
|
||||
name: "{{ opensm_image_full }}"
|
||||
repository: "{{ opensm_image_full }}"
|
||||
state: present
|
||||
|
@ -1 +0,0 @@
|
||||
deploy.yml
|
3
ansible/roles/opensm/tasks/upgrade.yml
Normal file
3
ansible/roles/opensm/tasks/upgrade.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- include: pull.yml
|
||||
- include: deploy.yml
|
Loading…
Reference in New Issue
Block a user