aboutsummaryrefslogtreecommitdiff
path: root/ansible/library
diff options
context:
space:
mode:
authorRadosław Piliszek <radoslaw.piliszek@gmail.com>2020-04-27 10:40:15 +0200
committerRadosław Piliszek <radoslaw.piliszek@gmail.com>2020-10-04 16:58:24 +0200
commitc2d0bf30ea0718f0f415af6b6b7dfc232b6e4706 (patch)
treefb4977c4607f1b0a163ed53e9d5a8f67997b14bb /ansible/library
parent4c4ad2b87bb53e127422e449c72dd2923a7049e2 (diff)
downloadkolla-ansible-c2d0bf30ea0718f0f415af6b6b7dfc232b6e4706.tar.gz
kolla-ansible-c2d0bf30ea0718f0f415af6b6b7dfc232b6e4706.zip
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
Diffstat (limited to 'ansible/library')
-rw-r--r--ansible/library/kolla_docker.py7
1 files changed, 5 insertions, 2 deletions
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']],