From c2d0bf30ea0718f0f415af6b6b7dfc232b6e4706 Mon Sep 17 00:00:00 2001 From: Radosław Piliszek Date: Mon, 27 Apr 2020 10:40:15 +0200 Subject: Coordinate haproxy and keepalived restarts Keepalived and haproxy cooperate to provide control plane HA in kolla-ansible deployments. Certain care should be exerted to avoid prolonged availability loss during reconfigurations and upgrades. This patch aims to provide this care. There is nothing special about keepalived upgrade compared to reconfig, hence it is simplified to run the same code as for deploy. The broken logic of safe upgrade is replaced by common handler code which's goal is to ensure we down current master only after we have backups ready. This change introduces a switch to kolla_docker module that allows to ignore missing containers (as they are logically stopped). ignore_missing is the switch's name. All tests are included. Change-Id: I22ddec5f7ee4a7d3d502649a158a7e005fe29c48 --- ansible/library/kolla_docker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ansible/library') diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py index edead35a5..224c42458 100644 --- a/ansible/library/kolla_docker.py +++ b/ansible/library/kolla_docker.py @@ -936,8 +936,10 @@ class DockerWorker(object): graceful_timeout = 10 container = self.check_container() if not container: - self.module.fail_json( - msg="No such container: {} to stop".format(name)) + ignore_missing = self.params.get('ignore_missing') + if not ignore_missing: + self.module.fail_json( + msg="No such container: {} to stop".format(name)) elif not container['Status'].startswith('Exited '): self.changed = True self.dc.stop(name, timeout=graceful_timeout) @@ -1069,6 +1071,7 @@ def generate_module(): dimensions=dict(required=False, type='dict', default=dict()), tty=dict(required=False, type='bool', default=False), client_timeout=dict(required=False, type='int', default=120), + ignore_missing=dict(required=False, type='bool', default=False), ) required_if = [ ['action', 'pull_image', ['image']], -- cgit v1.2.3