tripleo-ansible/playbooks/cleanup_rabbitmq_start.yml

32 lines
1.5 KiB
YAML

# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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: Determine if node is part of a cluster
shell: grep -q "$(hostname)" "/mnt/state/var/lib/rabbitmq/mnesia/rabbit@$(hostname)/cluster_nodes.config"
ignore_errors: yes
register: rabbit_cluster_test
- name: Collect names of post-configure.d rabbitmq files
shell: ls "{{os_refresh_config_folder}}/post-configure.d/"|grep '\-rabbitmq$'
register: test_rabbitmq_script_list
when: single_controller is not defined and rabbit_cluster_test.rc == 0
- name: If node rabbitmq cluster config was present, re-enable os-refresh-config post-configure.d.
sudo: yes
file: mode=0755 path="{{os_refresh_config_folder}}/post-configure.d/{{item}}"
when: single_controller is not defined and rabbit_cluster_test.rc == 0
with_items: test_rabbitmq_script_list.stdout_lines
- name: "Removing temporary rabbitmq-server override"
sudo: yes
file: path=/etc/init/rabbitmq-server.override state=absent