loadbalancer: 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: Ia72c7052d7f9b8c7d86d74a15dcd9e003178972b
This commit is contained in:
parent
2b88144c05
commit
984612f084
@ -61,14 +61,14 @@
|
|||||||
- not kolla_externally_managed_cert | bool
|
- not kolla_externally_managed_cert | bool
|
||||||
- kolla_enable_tls_external | bool
|
- kolla_enable_tls_external | bool
|
||||||
|
|
||||||
- name: Fail if external haproxy certificate is absent
|
- name: Assert that external haproxy certificate exists
|
||||||
run_once: true
|
run_once: true
|
||||||
fail:
|
assert:
|
||||||
msg: "External haproxy certificate file is not found. It is configured via 'kolla_external_fqdn_cert'"
|
that: haproxy_cert_file.stat.exists
|
||||||
|
fail_msg: "External haproxy certificate file is not found. It is configured via 'kolla_external_fqdn_cert'"
|
||||||
when:
|
when:
|
||||||
- not kolla_externally_managed_cert | bool
|
- not kolla_externally_managed_cert | bool
|
||||||
- kolla_enable_tls_external | bool
|
- kolla_enable_tls_external | bool
|
||||||
- not haproxy_cert_file.stat.exists
|
|
||||||
|
|
||||||
- name: Checking if internal haproxy certificate exists
|
- name: Checking if internal haproxy certificate exists
|
||||||
run_once: true
|
run_once: true
|
||||||
@ -81,26 +81,28 @@
|
|||||||
- not kolla_externally_managed_cert | bool
|
- not kolla_externally_managed_cert | bool
|
||||||
- kolla_enable_tls_internal | bool
|
- kolla_enable_tls_internal | bool
|
||||||
|
|
||||||
- name: Fail if internal haproxy certificate is absent
|
- name: Assert that internal haproxy certificate exists
|
||||||
run_once: true
|
run_once: true
|
||||||
fail:
|
assert:
|
||||||
msg: "Internal haproxy certificate file is not found. It is configured via 'kolla_internal_fqdn_cert'"
|
that: haproxy_internal_cert_file.stat.exists
|
||||||
|
fail_msg: "Internal haproxy certificate file is not found. It is configured via 'kolla_internal_fqdn_cert'"
|
||||||
when:
|
when:
|
||||||
- not kolla_externally_managed_cert | bool
|
- not kolla_externally_managed_cert | bool
|
||||||
- kolla_enable_tls_internal | bool
|
- kolla_enable_tls_internal | bool
|
||||||
- not haproxy_internal_cert_file.stat.exists
|
|
||||||
|
|
||||||
- name: Checking the kolla_external_vip_interface is present
|
- name: Checking the kolla_external_vip_interface is present
|
||||||
fail: "msg='Please check the kolla_external_vip_interface property - interface {{ kolla_external_vip_interface }} not found'"
|
assert:
|
||||||
|
that: kolla_external_vip_interface in ansible_facts.interfaces
|
||||||
|
fail_msg: "Please check the kolla_external_vip_interface property - interface {{ kolla_external_vip_interface }} not found"
|
||||||
when:
|
when:
|
||||||
- haproxy_enable_external_vip | bool
|
- haproxy_enable_external_vip | bool
|
||||||
- kolla_external_vip_interface not in ansible_facts.interfaces
|
|
||||||
|
|
||||||
- name: Checking the kolla_external_vip_interface is active
|
- name: Checking the kolla_external_vip_interface is active
|
||||||
fail: "msg='Please check the kolla_external_vip_interface settings - interface {{ kolla_external_vip_interface }} is not active'"
|
assert:
|
||||||
|
that: hostvars[inventory_hostname].ansible_facts[kolla_external_vip_interface]['active']
|
||||||
|
fail_msg: "Please check the kolla_external_vip_interface settings - interface {{ kolla_external_vip_interface }} is not active"
|
||||||
when:
|
when:
|
||||||
- haproxy_enable_external_vip | bool
|
- haproxy_enable_external_vip | bool
|
||||||
- not hostvars[inventory_hostname].ansible_facts[kolla_external_vip_interface]['active']
|
|
||||||
|
|
||||||
# NOTE(hrw): let assume that each supported host OS has ping with ipv4/v6 support
|
# NOTE(hrw): let assume that each supported host OS has ping with ipv4/v6 support
|
||||||
- name: Checking if kolla_internal_vip_address and kolla_external_vip_address are not pingable from any node
|
- name: Checking if kolla_internal_vip_address and kolla_external_vip_address are not pingable from any node
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
- name: Fail if group loadbalancer not exists or it is empty
|
- name: Checking loadbalancer group
|
||||||
fail:
|
assert:
|
||||||
msg: >-
|
that:
|
||||||
|
- groups['loadbalancer'] is defined
|
||||||
|
- groups['loadbalancer'] | length > 0
|
||||||
|
fail_msg: >-
|
||||||
Inventory's group loadbalancer does not exist or it is empty.
|
Inventory's group loadbalancer does not exist or it is empty.
|
||||||
Please update inventory, as haproxy group was renamed
|
Please update inventory, as haproxy group was renamed
|
||||||
to loadbalancer in the Xena release.
|
to loadbalancer in the Xena release.
|
||||||
when:
|
when:
|
||||||
- enable_loadbalancer | bool
|
- enable_loadbalancer | bool
|
||||||
- groups['loadbalancer'] is not defined or
|
|
||||||
groups['loadbalancer'] | length < 1
|
|
||||||
|
Loading…
Reference in New Issue
Block a user