feat: replace ansible templating with makejinja (#1156)
This commit is contained in:
1 parent
a4731906d9
commit
f9481d6202
114 files changed
+555
-906
No files matched your search
@@ -6,7 +6,7 @@
|
||||
loop_control:
|
||||
label: "{{ item.address }}"
|
||||
|
||||
- name: Verify master node count
|
||||
- name: Check that master node count is odd
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- bootstrap_nodes.master | length > 0
|
||||
@@ -14,27 +14,27 @@
|
||||
success_msg: Master node count {{ bootstrap_nodes.master | length }} is correct.
|
||||
fail_msg: Master node count {{ bootstrap_nodes.master | length }} is not greater than 0 or is not odd.
|
||||
|
||||
- name: Verify node CIDR
|
||||
- name: Check that node CIDR is ipv4
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_node_cidr is ansible.utils.ipv4
|
||||
success_msg: Node CIDR {{ bootstrap_node_cidr }} is valid.
|
||||
fail_msg: Node CIDR {{ bootstrap_node_cidr }} is invalid.
|
||||
|
||||
- name: Verify cluster CIDR is ipv4 OR ipv6
|
||||
- name: Check that cluster CIDR is ipv4 OR ipv6
|
||||
when: not bootstrap_ipv6_enabled | default(false)
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_cluster_cidr is ansible.utils.ipv4 or bootstrap_cluster_cidr is ansible.utils.ipv6
|
||||
success_msg: Cluster CIDR {{ bootstrap_cluster_cidr }} is valid.
|
||||
fail_msg: Cluster CIDR {{ bootstrap_cluster_cidr }} is invalid.
|
||||
|
||||
- name: Verify service CIDR is ipv4 OR ipv6
|
||||
- name: Check that service CIDR is ipv4 OR ipv6
|
||||
when: not bootstrap_ipv6_enabled | default(false)
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_service_cidr is ansible.utils.ipv4 or bootstrap_service_cidr is ansible.utils.ipv6
|
||||
success_msg: Service CIDR {{ bootstrap_service_cidr }} is valid.
|
||||
fail_msg: Service CIDR {{ bootstrap_service_cidr }} is invalid.
|
||||
|
||||
- name: Verify cluster CIDR is ipv4 AND ipv6
|
||||
- name: Check that cluster CIDR is ipv4 AND ipv6
|
||||
when: bootstrap_ipv6_enabled | default(false)
|
||||
ansible.builtin.assert:
|
||||
that: >
|
||||
@@ -48,7 +48,7 @@
|
||||
success_msg: Cluster CIDR {{ bootstrap_cluster_cidr }} is valid.
|
||||
fail_msg: Cluster CIDR {{ bootstrap_cluster_cidr }} is invalid.
|
||||
|
||||
- name: Verify service CIDR is ipv4 AND ipv6
|
||||
- name: Check that service CIDR is ipv4 AND ipv6
|
||||
when: bootstrap_ipv6_enabled | default(false)
|
||||
ansible.builtin.assert:
|
||||
that: >
|
||||
@@ -62,67 +62,67 @@
|
||||
success_msg: Service CIDR {{ bootstrap_service_cidr }} is valid.
|
||||
fail_msg: Service CIDR {{ bootstrap_service_cidr }} is invalid.
|
||||
|
||||
- name: Verify k8s_gateway
|
||||
- name: Check that k8s_gateway is ipv4
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_k8s_gateway_addr is ansible.utils.ipv4
|
||||
success_msg: k8s_gateway address {{ bootstrap_k8s_gateway_addr }} is valid.
|
||||
fail_msg: k8s_gateway address {{ bootstrap_k8s_gateway_addr }} is invalid.
|
||||
|
||||
- name: Verify k8s_gateway in node CIDR
|
||||
- name: Check that k8s_gateway is in node CIDR
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_k8s_gateway_addr)
|
||||
success_msg: k8s_gateway address {{ bootstrap_k8s_gateway_addr }} is within {{ bootstrap_node_cidr }}.
|
||||
fail_msg: k8s_gateway address {{ bootstrap_k8s_gateway_addr }} is not within {{ bootstrap_node_cidr }}.
|
||||
|
||||
- name: Verify internal ingress
|
||||
- name: Check that internal ingress is ipv4
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_internal_ingress_addr is ansible.utils.ipv4
|
||||
success_msg: internal ingress address {{ bootstrap_internal_ingress_addr }} is valid.
|
||||
fail_msg: internal ingress address {{ bootstrap_internal_ingress_addr }} is invalid.
|
||||
|
||||
- name: Verify internal ingress in node CIDR
|
||||
- name: Check that internal ingress is in node CIDR
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_internal_ingress_addr)
|
||||
success_msg: internal ingress address {{ bootstrap_internal_ingress_addr }} is within {{ bootstrap_node_cidr }}.
|
||||
fail_msg: internal ingress address {{ bootstrap_internal_ingress_addr }} is not within {{ bootstrap_node_cidr }}.
|
||||
|
||||
- name: Verify external ingress
|
||||
- name: Check that external ingress is ipv4
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_external_ingress_addr is ansible.utils.ipv4
|
||||
success_msg: external ingress address {{ bootstrap_external_ingress_addr }} is valid.
|
||||
fail_msg: external ingress address {{ bootstrap_external_ingress_addr }} is invalid.
|
||||
|
||||
- name: Verify external ingress in node CIDR
|
||||
- name: Check external ingress is in node CIDR
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_external_ingress_addr)
|
||||
success_msg: external ingress address {{ bootstrap_external_ingress_addr }} is within {{ bootstrap_node_cidr }}.
|
||||
fail_msg: external ingress address {{ bootstrap_external_ingress_addr }} is not within {{ bootstrap_node_cidr }}.
|
||||
|
||||
- name: Verify kubeapi address
|
||||
- name: Check that Kube API address is ipv4
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_kubeapi_addr is ansible.utils.ipv4
|
||||
success_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is valid.
|
||||
fail_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is invalid.
|
||||
that: bootstrap_kube_api_addr is ansible.utils.ipv4
|
||||
success_msg: Kube API address {{ bootstrap_kube_api_addr }} is valid.
|
||||
fail_msg: Kube API address {{ bootstrap_kube_api_addr }} is invalid.
|
||||
|
||||
- name: Verify kubeapi address in node CIDR
|
||||
- name: Check that Kube API address is in node CIDR
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_kubeapi_addr)
|
||||
success_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is within {{ bootstrap_node_cidr }}.
|
||||
fail_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is not within {{ bootstrap_node_cidr }}.
|
||||
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_kube_api_addr)
|
||||
success_msg: Kube API address {{ bootstrap_kube_api_addr }} is within {{ bootstrap_node_cidr }}.
|
||||
fail_msg: Kube API address {{ bootstrap_kube_api_addr }} is not within {{ bootstrap_node_cidr }}.
|
||||
|
||||
- name: Verify all IP addresses are unique
|
||||
- name: Check that all IP addresses are unique
|
||||
ansible.builtin.assert:
|
||||
that: >
|
||||
[
|
||||
bootstrap_k8s_gateway_addr,
|
||||
bootstrap_external_ingress_addr,
|
||||
bootstrap_internal_ingress_addr,
|
||||
bootstrap_kubeapi_addr
|
||||
bootstrap_kube_api_addr
|
||||
] | unique | length == 4
|
||||
success_msg: All IP addresses are unique.
|
||||
fail_msg: All IP addresses are not unique.
|
||||
|
||||
- name: Verify nodes are not the same IPs as k8s_gateway or ingress external/internal
|
||||
- name: Check that nodes are not the same IPs as k8s_gateway or ingress external/internal
|
||||
when: not bootstrap_kube_vip_enabled | default(true)
|
||||
ansible.builtin.assert:
|
||||
that: item.address not in (bootstrap_k8s_gateway_addr, bootstrap_external_ingress_addr, bootstrap_internal_ingress_addr)
|
||||
@@ -133,18 +133,18 @@
|
||||
loop_control:
|
||||
label: "{{ item.address }}"
|
||||
|
||||
- name: Verify nodes are not the same IPs as k8s_gateway, ingress external/internal or kubeapi address
|
||||
- name: Check that nodes are not the same IPs as k8s_gateway, ingress external/internal or Kube API address
|
||||
when: (bootstrap_distribution == "k3s") and (bootstrap_kube_vip_enabled | default(true))
|
||||
ansible.builtin.assert:
|
||||
that: item.address not in (bootstrap_k8s_gateway_addr, bootstrap_external_ingress_addr, bootstrap_internal_ingress_addr, bootstrap_kubeapi_addr)
|
||||
success_msg: Node address {{ item.address }} is different than k8s_gateway, ingress-nginx or kubeapi.
|
||||
fail_msg: Node address {{ item.address }} is not different than k8s_gateway, ingress-nginx or kubeapi.
|
||||
that: item.address not in (bootstrap_k8s_gateway_addr, bootstrap_external_ingress_addr, bootstrap_internal_ingress_addr, bootstrap_kube_api_addr)
|
||||
success_msg: Node address {{ item.address }} is different than k8s_gateway, ingress-nginx or Kube API.
|
||||
fail_msg: Node address {{ item.address }} is not different than k8s_gateway, ingress-nginx or Kube API.
|
||||
quiet: true
|
||||
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
||||
loop_control:
|
||||
label: "{{ item.address }}"
|
||||
|
||||
- name: Verify nodes are ipv4
|
||||
- name: Check that node addresses are ipv4
|
||||
ansible.builtin.assert:
|
||||
that: item.address is ansible.utils.ipv4
|
||||
success_msg: Node address {{ item.address }} is valid.
|
||||
@@ -154,7 +154,7 @@
|
||||
loop_control:
|
||||
label: "{{ item.address }}"
|
||||
|
||||
- name: Verify nodes are in node CIDR
|
||||
- name: Check that node addresses are in node CIDR
|
||||
ansible.builtin.assert:
|
||||
that: bootstrap_node_cidr | ansible.utils.network_in_usable(item.address)
|
||||
success_msg: Node address {{ item.address }} is within {{ bootstrap_node_cidr }}.
|
||||
@@ -165,7 +165,7 @@
|
||||
loop_control:
|
||||
label: "{{ item.address }}"
|
||||
|
||||
- name: Verify node IP addresses are unique
|
||||
- name: Check that node IP addresses are unique
|
||||
ansible.builtin.assert:
|
||||
that: >
|
||||
(
|
||||
@@ -179,7 +179,7 @@
|
||||
fail_msg: All node IP addresses are not unique.
|
||||
quiet: true
|
||||
|
||||
- name: Verify node names are unique
|
||||
- name: Check that node names are unique
|
||||
ansible.builtin.assert:
|
||||
that: >
|
||||
(
|
||||
@@ -193,7 +193,7 @@
|
||||
fail_msg: All node names are not unique.
|
||||
quiet: true
|
||||
|
||||
- name: Verify SSH port is reachable
|
||||
- name: Check that nodes SSH ports are reachable
|
||||
when: not ci_test | default(false)
|
||||
ansible.builtin.wait_for:
|
||||
host: "{{ current_address }}"
|
||||
|
||||
Reference in new issue
Block a user