diff --git a/builtin/core/roles/precheck/kubernetes/tasks/main.yaml b/builtin/core/roles/precheck/kubernetes/tasks/main.yaml index df919cff..dcf4b76d 100644 --- a/builtin/core/roles/precheck/kubernetes/tasks/main.yaml +++ b/builtin/core/roles/precheck/kubernetes/tasks/main.yaml @@ -45,7 +45,6 @@ when: - .image_registry.auth.registry | empty | not - .image_registry.type | empty - run_once: true command: | HTTP_CODE=$(curl -skLI -w "%{http_code}" -u "{{ .image_registry.auth.username }}:{{ .image_registry.auth.password }}" "https://{{ .image_registry.auth.registry }}/v2/" -o /dev/null) if [[ "$HTTP_CODE" == "200" ]]; then diff --git a/builtin/core/roles/precheck/os/tasks/main.yaml b/builtin/core/roles/precheck/os/tasks/main.yaml index be2ae4b1..ae318e3e 100644 --- a/builtin/core/roles/precheck/os/tasks/main.yaml +++ b/builtin/core/roles/precheck/os/tasks/main.yaml @@ -1,9 +1,18 @@ --- -- name: OS | Fail if hostname is invalid - assert: - that: .hostname | regexMatch "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$" - fail_msg: >- - The hostname "{{ .hostname }}" is invalid. Hostnames must use only lowercase alphanumeric characters, '.', or '-', and must start and end with an alphanumeric character. +- name: OS | Assert valid system hostname format + block: + - name: OS | Validate inventory hostname is RFC-compliant + when: .set_hostname + assert: + that: .inventory_hostname | regexMatch "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$" + fail_msg: >- + The hostname "{{ .inventory_hostname }}" is invalid. Hostnames must use only lowercase alphanumeric characters, '.', or '-', and must start and end with an alphanumeric character. + - name: OS | Validate current host system hostname is RFC-compliant + when: .set_hostname | not + assert: + that: .hostname | regexMatch "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$" + fail_msg: >- + The hostname "{{ .hostname }}" is invalid. Hostnames must use only lowercase alphanumeric characters, '.', or '-', and must start and end with an alphanumeric character. - name: OS | Fail if operating system is not supported assert: