]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
validate: check virtual_ips variable
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 11 Jan 2021 09:06:08 +0000 (10:06 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 12 Jan 2021 10:03:12 +0000 (11:03 +0100)
This commit checks the length of `virtual_ips` doesn't exceed the length
of `groups[rgwloadbalancer_group_name]`.
It also ensure this variable is defined when
`groups[rgwloadbalancer_group_name]` contains at least one node.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-validate/tasks/main.yml

index 9145bfaa8990b4d2dd5c6bf1328d5b417a17ff60..b6d33a690ab2808756e0d93c166e24182f1c627c 100644 (file)
     - keys is defined
     - keys | length > 0
     - item.caps is not defined
+
+- name: check virtual_ips is defined
+  fail:
+    msg: "virtual_ips is not defined."
+  when:
+    - rgwloadbalancer_group_name in group_names
+    - groups[rgwloadbalancer_group_name] | length > 0
+    - virtual_ips is not defined
+
+- name: validate virtual_ips length
+  fail:
+    msg: "There are more virual_ips defined than rgwloadbalancer nodes"
+  when:
+    - rgwloadbalancer_group_name in group_names
+    - (virtual_ips | length) > (groups[rgwloadbalancer_group_name] | length)