---
# Copyright 2016, 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: Grab full output of rabbitmqctl cluster_status
  command: "rabbitmqctl cluster_status"
  register: rabbitmqctl_output
  failed_when: "rabbitmqctl_output.rc != 0"

- name: Display output of rabbitmqctl cluster_status
  debug: var=rabbitmqctl_output

# Verify rabbit is not partitioned
# Here we check to see if partitions is empty
- name: Fail if network partitions are detected
  fail:
    msg: "Rabbitmq network partitions have been detected."
  when: "' {partitions,[]},' not in rabbitmqctl_output.stdout_lines"

---
# Copyright 2016, 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: Grab full output of rabbitmqctl cluster_status
  command: "rabbitmqctl cluster_status"
  register: rabbitmqctl_output
  failed_when: "rabbitmqctl_output.rc != 0"

- name: Display output of rabbitmqctl cluster_status
  debug: var=rabbitmqctl_output

# Verify rabbit is not partitioned
# Here we check to see if partitions is empty
- name: Fail if network partitions are detected
  fail:
    msg: "Rabbitmq network partitions have been detected."
  when: "'{partitions,[]}' not in rabbitmqctl_output.stdout_lines"

Remove trailing comma and leading space in match
Remove trailing comma and leading space in match
