kubekey/builtin/capkk/roles/precheck/env_check/tasks/os.yaml
liujian 86ff6371b6
Uninstall docker interface (#2478)
Signed-off-by: joyceliu <joyceliu@yunify.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
2025-03-05 18:55:12 +08:00

39 lines
1.7 KiB
YAML

---
- name: Stop if bad hostname
assert:
that: .hostname | regexMatch "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$"
fail_msg: "Hostname must consist of lower case alphanumeric characters, '.' or '-', and must start and end with an alphanumeric character"
- name: Stop if the os does not support
assert:
that: or (.cluster_require.allow_unsupported_distribution_setup) (.cluster_require.supported_os_distributions | has .os.release.ID)
fail_msg: "{{ .os.release.ID }} is not a known OS"
- name: Stop if arch supported
assert:
that: or (.cluster_require.supported_architectures.amd64 | has .os.architecture) (.cluster_require.supported_architectures.arm64 | has .os.architecture)
success_msg: |
{{- if .cluster_require.supported_architectures.amd64 | has .os.architecture }}
amd64
{{- else }}
arm64
{{- end }}
fail_msg: "{{ .os.architecture }} is not a known arch"
register: binary_type
- name: Stop if memory is too small for masters
assert:
that: .process.memInfo.MemTotal | trimSuffix " kB" | atoi | le .cluster_require.minimal_master_memory_mb
when: .groups.kube_control_plane | default list | has .inventory_name
- name: Stop if memory is too small for nodes
assert:
that: .process.memInfo.MemTotal | trimSuffix " kB" | atoi | le .cluster_require.minimal_node_memory_mb
when:
- .groups.kube_worker | default list | has .inventory_name
- name: Stop if kernel version is too low
assert:
that: .os.kernel_version | splitList "-" | first | semverCompare (printf ">=%s" .cluster_require.min_kernel_version)
fail_msg: "kernel version: {{ .os.kernel_version }} is too low, required at least: {{ .cluster_require.min_kernel_version }} "