From 176452bebf7e1ceabd2cf72a89c558c0fc7f1420 Mon Sep 17 00:00:00 2001 From: Nolan Brubaker Date: Thu, 29 Jun 2017 14:55:29 -0400 Subject: [PATCH] Don't run sync in upgrades When running a rolling upgrade, each swift node is addressed individually. This can result in undefined variables when a node doesn't have the necessary SSH and ring information. For minor upgrades, these changes are not necessary. They are only necessary in fresh installs, or modifying storage capacity. Thus, this patch checks to see if it's a new install (no swift venv_tag previously defined) or it's the same version (current venv tag matches the previous one) and only does syncs in those cases. Change-Id: Ice3b4526609f5a5fd4472c8408de9ed08aea29e6 --- tasks/main.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 12e00cfd..835219d7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -84,15 +84,32 @@ tags: - swift-config +# When doing rolling upgrades, we addres a single node at a time +# In these instances, the variables necessary to do sync/key work aren't available, +# nor is the sync/key updating necessary. Thus, skip that work on upgrade. +- name: Check if installing or upgrading + set_fact: + need_sync: True + when: + - ansible_local is defined + - ('swift' not in ansible_local['openstack_ansible'] or + 'venv_tag' not in ansible_local['openstack_ansible']['swift'] or + ansible_local['openstack_ansible']['swift']['venv_tag'] == swift_venv_tag) + tags: swift-config + - include: swift_key_setup.yml static: no - when: swift_do_sync | bool + when: + - swift_do_sync | bool + - need_sync is defined tags: - swift-config - include: swift_rings.yml static: no - when: swift_do_sync | bool + when: + - swift_do_sync | bool + - need_sync is defined tags: - swift-config - swift-rings