From 77e09196049cc7f1b450966e45a0d5205463fe18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20F=C3=9CHRMANN?= Date: Wed, 30 Sep 2020 11:21:12 +0200 Subject: [PATCH] Fix stop containers task in Swift rolling restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When applying upgrade action on Swift, rolling restart was not stopping containers on the right hosts if all Swift containers were not deployed on the same host. This patch proposes to use the same kind of detection already done in reconfigure and associate a container to a group. Closes-Bug: 1899280 Change-Id: I75e31554228350ff2e1c2f53ff864f8649c8d618 Signed-off-by: Benjamin FÜHRMANN --- ansible/roles/swift/tasks/rolling_upgrade.yml | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/ansible/roles/swift/tasks/rolling_upgrade.yml b/ansible/roles/swift/tasks/rolling_upgrade.yml index 5f62a810c1..8899927ffc 100644 --- a/ansible/roles/swift/tasks/rolling_upgrade.yml +++ b/ansible/roles/swift/tasks/rolling_upgrade.yml @@ -1,4 +1,24 @@ --- +- name: Prepare Swift containers list + set_fact: + swift_containers: + - { name: swift_account_server, group: swift-account-server } + - { name: swift_account_auditor, group: swift-account-server } + - { name: swift_account_replicator, group: swift-account-server } + - { name: swift_account_reaper, group: swift-account-server } + - { name: swift_rsyncd, group: swift-account-server } + - { name: swift_container_server, group: swift-container-server } + - { name: swift_container_auditor, group: swift-container-server } + - { name: swift_container_replicator, group: swift-container-server } + - { name: swift_container_updater, group: swift-container-server } + - { name: swift_rsyncd, group: swift-container-server } + - { name: swift_object_server, group: swift-object-server } + - { name: swift_object_auditor, group: swift-object-server } + - { name: swift_object_replicator, group: swift-object-server } + - { name: swift_object_updater, group: swift-object-server } + - { name: swift_object_expirer, group: swift-object-server } + - { name: swift_rsyncd, group: swift-object-server } + # Upgrade swift storage nodes first - include_tasks: config.yml when: inventory_hostname in groups['swift-account-server'] or @@ -12,25 +32,10 @@ become: true kolla_docker: action: "stop_container" - name: "{{ item }}" + name: "{{ item.name }}" + when: inventory_hostname in groups[item.group] with_items: - - "swift_rsyncd" - - "swift_account_server" - - "swift_account_auditor" - - "swift_account_replicator" - - "swift_account_reaper" - - "swift_container_server" - - "swift_container_auditor" - - "swift_container_replicator" - - "swift_container_updater" - - "swift_object_server" - - "swift_object_auditor" - - "swift_object_replicator" - - "swift_object_updater" - - "swift_object_expirer" - when: inventory_hostname in groups['swift-account-server'] or - inventory_hostname in groups['swift-container-server'] or - inventory_hostname in groups['swift-object-server'] + - "{{ swift_containers }}" - import_tasks: start.yml vars: