mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
fix: use var .native.set_hostname
Signed-off-by: William Wang <williamw0825@gmail.com>
This commit is contained in:
parent
67fd6098c1
commit
99116417d1
|
|
@ -3,7 +3,7 @@
|
|||
hostnamectl set-hostname {{ .inventory_hostname }} \
|
||||
&& sed -i '/^127.0.1.1/s/.*/127.0.1.1 {{ .inventory_hostname }}/g' {{ .item }}
|
||||
when:
|
||||
- .set_hostname
|
||||
- .native.set_hostname
|
||||
- .inventory_hostname | ne "localhost"
|
||||
loop: "{{ .native.localDNS | toJson }}"
|
||||
- name: OS | Synchronize initialization script to remote node
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
- name: OS | Assert valid system hostname format
|
||||
block:
|
||||
- name: OS | Validate inventory hostname is RFC-compliant
|
||||
when: .set_hostname
|
||||
when: .native.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
|
||||
when: .native.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: >-
|
||||
|
|
|
|||
Loading…
Reference in New Issue