mirror of https://github.com/easzlab/kubeasz.git
set hostname in task 'prepare'
parent
7acb1e0237
commit
054a6c140f
|
@ -34,9 +34,13 @@ K8S_VER: "__k8s_ver__"
|
||||||
K8S_NODENAME: "{%- if k8s_nodename != '' -%} \
|
K8S_NODENAME: "{%- if k8s_nodename != '' -%} \
|
||||||
{{ k8s_nodename|replace('_', '-')|lower }} \
|
{{ k8s_nodename|replace('_', '-')|lower }} \
|
||||||
{%- else -%} \
|
{%- else -%} \
|
||||||
{{ inventory_hostname }} \
|
{{ inventory_hostname|replace('.', '-') }} \
|
||||||
{%- endif -%}"
|
{%- endif -%}"
|
||||||
|
|
||||||
|
# use 'K8S_NODENAME' to set hostname
|
||||||
|
ENABLE_SETTING_HOSTNAME: true
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# role:etcd
|
# role:etcd
|
||||||
############################
|
############################
|
||||||
|
|
1
ezdown
1
ezdown
|
@ -93,6 +93,7 @@ available OSes:
|
||||||
ubuntu_18 to download package of Ubuntu 18.04
|
ubuntu_18 to download package of Ubuntu 18.04
|
||||||
ubuntu_20 to download package of Ubuntu 20.04
|
ubuntu_20 to download package of Ubuntu 20.04
|
||||||
ubuntu_22 to download package of Ubuntu 22.04
|
ubuntu_22 to download package of Ubuntu 22.04
|
||||||
|
ubuntu_24 to download package of Ubuntu 24.04
|
||||||
examples:
|
examples:
|
||||||
./ezdown -P ubuntu_22
|
./ezdown -P ubuntu_22
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -42,6 +42,13 @@
|
||||||
regexp: 'easzlab.io.local'
|
regexp: 'easzlab.io.local'
|
||||||
line: "{{ ansible_env.SSH_CLIENT.split(' ')[0] }} easzlab.io.local"
|
line: "{{ ansible_env.SSH_CLIENT.split(' ')[0] }} easzlab.io.local"
|
||||||
|
|
||||||
|
# 设置节点hostname,calico 网络组件要求每个节点不一样的hostname
|
||||||
|
- name: 设置节点 hostname
|
||||||
|
hostname:
|
||||||
|
name: "{{ K8S_NODENAME }}"
|
||||||
|
use: systemd
|
||||||
|
when: "ENABLE_SETTING_HOSTNAME|bool"
|
||||||
|
|
||||||
# 设置节点名称{{ K8S_NODENAME }} /etc/hosts 解析
|
# 设置节点名称{{ K8S_NODENAME }} /etc/hosts 解析
|
||||||
# 1.先确保第一个主节点做好解析
|
# 1.先确保第一个主节点做好解析
|
||||||
- name: 设置 k8s_nodename 在 master[0] 节点 /etc/hosts 地址解析
|
- name: 设置 k8s_nodename 在 master[0] 节点 /etc/hosts 地址解析
|
||||||
|
|
Loading…
Reference in New Issue