Files
home-cluster/bootstrap/tasks/validation/vars.yaml
T
2024-01-15 20:23:49 -05:00

48 lines
1.7 KiB
YAML

---
- name: Check if required bootstrap vars are set
ansible.builtin.assert:
that:
- item in vars
- vars[item] != None
success_msg: Required bootstrap var {{ item }} exists and is defined
fail_msg: Required bootstrap var {{ item }} does not exists or is not defined
loop:
- bootstrap_acme_email
- bootstrap_age_public_key
- bootstrap_cilium_loadbalancer_mode
- bootstrap_cloudflare_account_tag
- bootstrap_cloudflare_domain
- bootstrap_cloudflare_token
- bootstrap_cloudflare_tunnel_id
- bootstrap_cloudflare_tunnel_secret
- bootstrap_cluster_cidr
- bootstrap_distribution
- bootstrap_external_ingress_addr
- bootstrap_flux_github_webhook_token
- bootstrap_github_repository_branch
- bootstrap_github_repository_name
- bootstrap_github_username
- bootstrap_internal_ingress_addr
- bootstrap_ipv6_enabled
- bootstrap_k8s_gateway_addr
- bootstrap_kube_api_addr
- bootstrap_local_storage_path
- bootstrap_node_cidr
- bootstrap_service_cidr
- bootstrap_timezone
- name: Check if bootstrap distribution is valid
ansible.builtin.assert:
that: bootstrap_distribution in ['k0s', 'k3s']
success_msg: Distribution {{ bootstrap_distribution }} is valid
fail_msg: Distribution {{ bootstrap_distribution }} is not valid
- name: Check if bootstrap node names are valid
ansible.builtin.assert:
that: item.name is match('^[a-z0-9-\.]+$')
success_msg: Node name {{ item.name }} is valid
fail_msg: Node name {{ item.name }} is not valid
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
loop_control:
label: "{{ item.name }}"