From 5bc5ae944a32d5c24090a4c5f5e44c64c2879c1a Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Wed, 5 Dec 2018 15:09:07 +0100 Subject: [PATCH] Perform docker reconfiguration on upgrade_tasks. The container-registry role is idempotent in a way that the restarting of the docker service will be done only if some configuration value has changed. During the upgrade, host_prep_tasks are being run and if the new templates bring some configuration change then the Docker service gets restarted. The issue is the point at which they get restarted, which is after the upgrade_tasks have already run and prior to the deploy_tasks. This is causing issues with Pacemaker handled resources. For that reason, we include the very same task running in host_prep_tasks into upgrade_tasks for the docker and docker-registry services, forcing the Docker service reconfiguration to happen during upgrade_tasks instead of at a latter point. Closes-Bug: #1807418 Change-Id: I5e6ca987c01ff72a3c7e8900f9572024521164de --- puppet/services/docker-registry.yaml | 15 +++++++++++---- puppet/services/docker.yaml | 10 ++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/puppet/services/docker-registry.yaml b/puppet/services/docker-registry.yaml index e0c13ee307..faeeda59c3 100644 --- a/puppet/services/docker-registry.yaml +++ b/puppet/services/docker-registry.yaml @@ -54,7 +54,7 @@ outputs: - name: Install, Configure and Run Docker Distribution block: # NOTE(bogdando): w/a https://github.com/ansible/ansible/issues/42621 - - set_fact: + - set_fact: &docker_vars container_registry_host: if: - local_container_registry_is_empty @@ -65,6 +65,13 @@ outputs: name: container-registry tasks_from: docker-distribution upgrade_tasks: - - name: Install docker packages on upgrade if missing - when: step|int == 3 - package: name=docker-distribution state=latest + - block: + - name: Install docker packages on upgrade if missing + when: step|int == 3 + package: name=docker-distribution state=latest + - set_fact: *docker_vars + - name: Reconfigure Docker if needed + include_role: + name: container-registry + tasks_from: docker + when: step|int = 3 diff --git a/puppet/services/docker.yaml b/puppet/services/docker.yaml index b6d29698dd..ea0c3efd62 100644 --- a/puppet/services/docker.yaml +++ b/puppet/services/docker.yaml @@ -120,9 +120,15 @@ outputs: ovn_metadata: docker_additional_sockets: {get_param: DockerAdditionalSockets} upgrade_tasks: - - name: Install docker packages on upgrade if missing + - block: + - name: Install docker packages on upgrade if missing + package: name=docker state=latest + - set_fact: *docker_vars + - name: Reconfigure Docker if needed + include_role: + name: container-registry + tasks_from: docker when: step|int == 3 - package: name=docker state=latest update_tasks: - name: Restart Docker when needed when: step|int == 2