2019-12-21 18:11:30 +01:00
|
|
|
---
|
|
|
|
|
2020-01-11 13:31:23 +01:00
|
|
|
- name: Check the conditions when a single controller is defined
|
2019-12-21 18:11:30 +01:00
|
|
|
assert:
|
|
|
|
that:
|
2020-01-11 13:31:23 +01:00
|
|
|
- (k3s_controller_count | length == 1)
|
|
|
|
and (k3s_datastore_endpoint is not defined or not k3s_datastore_endpoint)
|
|
|
|
and (k3s_dqlite_datastore is not defined or not k3s_dqlite_datastore)
|
2020-09-17 22:01:20 +02:00
|
|
|
and (k3s_etcd_datastore is not defined or not k3s_etcd_datastore)
|
2020-01-11 13:31:23 +01:00
|
|
|
success_msg: "Control plane configuration is valid."
|
|
|
|
fail_msg: "Control plane configuration is invalid. Please see notes about k3s_control_node and HA in README.md."
|
|
|
|
when: k3s_controller_count | length == 1
|
2020-05-30 16:16:20 +02:00
|
|
|
and not k3s_use_unsupported_config
|
2020-01-11 13:31:23 +01:00
|
|
|
|
|
|
|
- name: Check the conditions when multiple controllers are defined
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- (k3s_controller_count | length >= 2)
|
|
|
|
and ((k3s_datastore_endpoint is defined and k3s_datastore_endpoint)
|
2020-09-17 22:01:20 +02:00
|
|
|
or (k3s_dqlite_datastore is defined and k3s_dqlite_datastore)
|
|
|
|
or (k3s_etcd_datastore is defined and k3s_etcd_datastore))
|
2020-01-11 13:31:23 +01:00
|
|
|
success_msg: "Control plane configuration is valid."
|
|
|
|
fail_msg: "Control plane configuration is invalid. Please see notes about k3s_control_node and HA in README.md."
|
|
|
|
when: k3s_controller_count | length >= 2
|
2020-09-21 20:38:51 +02:00
|
|
|
|
|
|
|
- name: Check the conditions when embedded etcd is defined
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- (k3s_controller_count | length >= 3)
|
|
|
|
and (((k3s_controller_count | length) % 2) == 1)
|
|
|
|
success_msg: "Control plane configuration is valid."
|
|
|
|
fail_msg: "Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md"
|
|
|
|
when: k3s_etcd_datastore and not k3s_use_unsupported_config
|