kolla-ansible/ansible/roles/swift/tasks/rolling_upgrade.yml
Benjamin FÜHRMANN 77e0919604 Fix stop containers task in Swift rolling restart
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 <benjamin.fuhrmann@gmail.com>
2020-10-10 20:09:10 +02:00

67 lines
2.7 KiB
YAML

---
- 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
inventory_hostname in groups['swift-container-server'] or
inventory_hostname in groups['swift-object-server']
# TODO(donghm): Below tasks should be run in serial nodes to
# decrease downtime. Update once the module ansible strategy for
# rolling upgrade will be finished.
- name: Gracefully shutdown swift services in storage nodes
become: true
kolla_docker:
action: "stop_container"
name: "{{ item.name }}"
when: inventory_hostname in groups[item.group]
with_items:
- "{{ swift_containers }}"
- import_tasks: start.yml
vars:
run_start_swift_proxy_server: "no"
# Upgrade swift proxy nodes
- include_tasks: config.yml
when: inventory_hostname in groups['swift-proxy-server']
- name: Gracefully shutdown swift proxy services in proxy nodes
become: true
kolla_docker:
action: "stop_container"
name: "swift_proxy_server"
when: inventory_hostname in groups['swift-proxy-server']
- name: Start new swift proxy server container
become: true
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ swift_proxy_server_image_full }}"
name: "swift_proxy_server"
volumes:
- "{{ node_config_directory }}/swift/:/var/lib/kolla/swift/:ro"
- "{{ node_config_directory }}/swift-proxy-server/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
when: inventory_hostname in groups['swift-proxy-server']