
Based on [1], this patch implements changes to the playbook which executes the cinder deployment in a play per host group, serialised to ensure that: 1. The services are changed in the right order. 2. The services remain available at all times during an upgrade. 3. Online data migrations are actioned once all versions of software are at the same levels. 4. If services are sharing a host/container then the role execution will not execute twice on the same host. [1] https://docs.openstack.org/developer/cinder/upgrade.html#minimal-downtime-upgrade-procedure Depends-On: Id95cae40f736ea2c84200955fccdb44ea3bc1dd8 Depends-On: If5729671cb69f928df660ec2d9ba83fe3f567946 Depends-On: I9aacda78f92355374af3f4ab24d2d9a9b47491ed Change-Id: I0bdb51ce0d8b3b9a145d29ef6808e1fe595924e2
46 lines
1.6 KiB
YAML
46 lines
1.6 KiB
YAML
---
|
|
# Copyright 2017, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# This is a generic task set which can be used to execute
|
|
# a service action on target hosts for any services. This
|
|
# is useful for executing a SIGHUP (reload) to load up any
|
|
# configuration changes or to restart services as required.
|
|
#
|
|
# Inputs:
|
|
# - service_name: Any service found matching this prefix will be acted on.
|
|
# - service_action: The action to execute [stop, start, restart, reload].
|
|
|
|
- name: Gather service list
|
|
shell: "systemctl list-unit-files --state=enabled --type=service | awk '/{{ service_name }}.* enabled$/ {print $1}'"
|
|
args:
|
|
executable: "/bin/bash"
|
|
register: _enabled_services
|
|
changed_when: false
|
|
|
|
- name: Execute service action
|
|
service:
|
|
name: "{{ service_file }}"
|
|
state: "{{ service_action }}"
|
|
with_items: "{{ _enabled_services.stdout_lines }}"
|
|
loop_control:
|
|
loop_var: service_file
|
|
|
|
- name: Disable the service restart requirement
|
|
ini_file:
|
|
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
|
section: "{{ service_fact | default(service_name) }}"
|
|
option: need_service_restart
|
|
value: False
|