rabbitmq: Use assert on checks for readability
assert will also fail when we're not meeting the conditions, makes clear what we're actually testing, and isn't listed as a skipped task when the condition is ok. Change-Id: I4c919b523dde2602c81179ab3d28b913650b4c9f
This commit is contained in:
parent
2b88144c05
commit
e0538c81f3
@ -76,30 +76,30 @@
|
|||||||
- not item.1 is match('^'+('api' | kolla_address(item.0.item))+'\\b')
|
- not item.1 is match('^'+('api' | kolla_address(item.0.item))+'\\b')
|
||||||
|
|
||||||
- name: Check if TLS certificate exists for RabbitMQ
|
- name: Check if TLS certificate exists for RabbitMQ
|
||||||
|
assert:
|
||||||
|
that: cert | length > 0
|
||||||
|
fail_msg: No TLS certificate provided for RabbitMQ.
|
||||||
vars:
|
vars:
|
||||||
cert: "{{ query('first_found', paths, errors='ignore') }}"
|
cert: "{{ query('first_found', paths, errors='ignore') }}"
|
||||||
paths:
|
paths:
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/rabbitmq-cert.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/rabbitmq-cert.pem"
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-cert.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-cert.pem"
|
||||||
- "{{ kolla_certificates_dir }}/rabbitmq-cert.pem"
|
- "{{ kolla_certificates_dir }}/rabbitmq-cert.pem"
|
||||||
fail:
|
|
||||||
msg: No TLS certificate provided for RabbitMQ.
|
|
||||||
when:
|
when:
|
||||||
- rabbitmq_enable_tls | bool
|
- rabbitmq_enable_tls | bool
|
||||||
- cert | length == 0
|
|
||||||
|
|
||||||
- name: Check if TLS key exists for RabbitMQ
|
- name: Check if TLS key exists for RabbitMQ
|
||||||
|
assert:
|
||||||
|
that: key | length > 0
|
||||||
|
fail_msg: No TLS key provided for RabbitMQ.
|
||||||
vars:
|
vars:
|
||||||
key: "{{ query('first_found', paths, errors='ignore') }}"
|
key: "{{ query('first_found', paths, errors='ignore') }}"
|
||||||
paths:
|
paths:
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/rabbitmq-key.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/rabbitmq-key.pem"
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-key.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-key.pem"
|
||||||
- "{{ kolla_certificates_dir }}/rabbitmq-key.pem"
|
- "{{ kolla_certificates_dir }}/rabbitmq-key.pem"
|
||||||
fail:
|
|
||||||
msg: No TLS key provided for RabbitMQ.
|
|
||||||
when:
|
when:
|
||||||
- rabbitmq_enable_tls | bool
|
- rabbitmq_enable_tls | bool
|
||||||
- key | length == 0
|
|
||||||
|
|
||||||
- name: Checking free port for outward RabbitMQ
|
- name: Checking free port for outward RabbitMQ
|
||||||
wait_for:
|
wait_for:
|
||||||
@ -166,29 +166,29 @@
|
|||||||
- not item.1 is match('^'+('api' | kolla_address(item.0.item))+'\\b')
|
- not item.1 is match('^'+('api' | kolla_address(item.0.item))+'\\b')
|
||||||
|
|
||||||
- name: Check if TLS certificate exists for outward RabbitMQ
|
- name: Check if TLS certificate exists for outward RabbitMQ
|
||||||
|
assert:
|
||||||
|
that: cert | length > 0
|
||||||
|
fail_msg: No TLS certificate provided for outward RabbitMQ.
|
||||||
vars:
|
vars:
|
||||||
cert: "{{ query('first_found', paths, errors='ignore') }}"
|
cert: "{{ query('first_found', paths, errors='ignore') }}"
|
||||||
paths:
|
paths:
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/outward_rabbitmq-cert.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/outward_rabbitmq-cert.pem"
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-cert.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-cert.pem"
|
||||||
- "{{ kolla_certificates_dir }}/outward_rabbitmq-cert.pem"
|
- "{{ kolla_certificates_dir }}/outward_rabbitmq-cert.pem"
|
||||||
fail:
|
|
||||||
msg: No TLS certificate provided for outward RabbitMQ.
|
|
||||||
when:
|
when:
|
||||||
- enable_outward_rabbitmq | bool
|
- enable_outward_rabbitmq | bool
|
||||||
- rabbitmq_enable_tls | bool
|
- rabbitmq_enable_tls | bool
|
||||||
- cert | length == 0
|
|
||||||
|
|
||||||
- name: Check if TLS key exists for outward RabbitMQ
|
- name: Check if TLS key exists for outward RabbitMQ
|
||||||
|
assert:
|
||||||
|
that: key | length > 0
|
||||||
|
msg: No TLS key provided for outward RabbitMQ.
|
||||||
vars:
|
vars:
|
||||||
key: "{{ query('first_found', paths, errors='ignore') }}"
|
key: "{{ query('first_found', paths, errors='ignore') }}"
|
||||||
paths:
|
paths:
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/outward_rabbitmq-key.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}/outward_rabbitmq-key.pem"
|
||||||
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-key.pem"
|
- "{{ kolla_certificates_dir }}/{{ inventory_hostname }}-key.pem"
|
||||||
- "{{ kolla_certificates_dir }}/outward_rabbitmq-key.pem"
|
- "{{ kolla_certificates_dir }}/outward_rabbitmq-key.pem"
|
||||||
fail:
|
|
||||||
msg: No TLS key provided for outward RabbitMQ.
|
|
||||||
when:
|
when:
|
||||||
- enable_outward_rabbitmq | bool
|
- enable_outward_rabbitmq | bool
|
||||||
- rabbitmq_enable_tls | bool
|
- rabbitmq_enable_tls | bool
|
||||||
- key | length == 0
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user