Files
ac1661432631755ea98188fb13a728df933131d5
openstack-ansible-rabbitmq_... /tests /test-rabbitmq-functional.yml

85 lines
3.3 KiB
YAML
Raw Normal View History

# 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.
any_errors_fatal:true
gather_facts:true
tasks:
slurp:
path:"/etc/rabbitmq/rabbitmq.pem"
set_fact:
rabbitmq_config_contents:"{{ rabbitmq_config.content | b64decode }}"
assert:
that:
- "'ssl_options.certfile = /etc/rabbitmq/rabbitmq.pem' in rabbitmq_config_contents"
- "'ssl_options.keyfile = /etc/rabbitmq/rabbitmq.key' in rabbitmq_config_contents"
- not rabbitmq_ssl_cert_stat['expired']
- rabbitmq_ssl_cert_stat['issuer']['commonName'] == 'RabbitMQ Intermediate CA'
- rabbitmq_ssl_cert_stat['subject']['commonName'] == inventory_hostname
- "'IP:' ~ rabbitmq_node_address in rabbitmq_ssl_cert_stat['subject_alt_name']"
command:rabbitmqctl cluster_status --formatter json
register:rabbitmqctl_cluster_status
changed_when:false
vars:
cluster_status:"{{ rabbitmqctl_cluster_status.stdout | from_json }}"
node_status:"{{ rabbitmqctl_status.stdout | from_json }}"
cluster_rabbit_versions:"{{ cluster_status['versions'].values() | map(attribute='rabbitmq_version') | unique }}"
cluster_erlang_versions:"{{ cluster_status['versions'].values() | map(attribute='erlang_version') | unique }}"
that:
- node_status['alarms'] | length == 0
- "'rabbitmq_management' in node_status['active_plugins']"
- cluster_rabbit_versions | length == 1
- cluster_erlang_versions | length == 1
- cluster_status['running_nodes'] | length == 3
- cluster_status['disk_nodes'] | length == 3
assert:
that:rabbitmq_policies_output.stdout | from_json | selectattr('name', 'eq', 'CQv2') | length > 0