50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
---
|
|
# Copyright 2015, 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.
|
|
|
|
- name: Prevent RabbitMQ from starting on install
|
|
ansible.builtin.copy:
|
|
src: "policy-rc.d"
|
|
dest: "/usr/sbin/policy-rc.d"
|
|
mode: "0755"
|
|
backup: true
|
|
tags:
|
|
- rabbitmq-policy-file
|
|
- rabbitmq-upgrade
|
|
|
|
- name: Set node for maintenance state
|
|
ansible.builtin.command: rabbitmq-upgrade drain --quiet
|
|
changed_when: false
|
|
# NOTE(mossblaser) The rabbitmq-upgrade drain command appears to occasionally
|
|
# return status 69 despite success:
|
|
#
|
|
# https://github.com/rabbitmq/rabbitmq-server/issues/3369
|
|
#
|
|
# Since missing this step in the worst case should just result in a less
|
|
# graceful failover, tolerating the failure is appropriate whilst this issue
|
|
# remains.
|
|
register: _rabbitmq_upgrade_drain
|
|
failed_when: _rabbitmq_upgrade_drain.rc not in [0, 69]
|
|
|
|
- name: Pause to allow node to sync
|
|
ansible.builtin.pause:
|
|
seconds: 10
|
|
|
|
- name: "Ensure RabbitMQ is stopped"
|
|
ansible.builtin.service:
|
|
name: rabbitmq-server
|
|
state: stopped
|
|
notify:
|
|
- RabbitMQ start
|