add roles support for worker nodes
This commit is contained in:
@@ -1,47 +1,23 @@
|
||||
{{- range .Hosts }}
|
||||
{{- range .Hosts.Masters }}
|
||||
{{ .Hostname }} ansible_host={{ .Ip }} ip={{ .Ip }} {{ if .User }}ansible_user={{ .User }}{{- end }} {{ if .Password }}ansible_ssh_password={{ .Password }}{{- end }}
|
||||
{{- end }}
|
||||
{{- range .Hosts.Workers }}
|
||||
{{ .Hostname }} ansible_host={{ .Ip }} ip={{ .Ip }} {{ if .User }}ansible_user={{ .User }}{{- end }} {{ if .Password }}ansible_ssh_password={{ .Password }}{{- end }}
|
||||
{{- end }}
|
||||
|
||||
[kube_control_plane]
|
||||
{{- range .Hosts }}
|
||||
{{- $search := "control_plane" -}}
|
||||
{{- $found := false -}}
|
||||
{{- range .Roles }}
|
||||
{{- if eq . $search }}
|
||||
{{- $found = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $found }}
|
||||
{{- range .Hosts.Masters }}
|
||||
{{ .Hostname }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
[etcd]
|
||||
{{- range .Hosts }}
|
||||
{{- $search := "etcd" -}}
|
||||
{{- $found := false -}}
|
||||
{{- range .Roles }}
|
||||
{{- if eq . $search }}
|
||||
{{- $found = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $found }}
|
||||
{{- range .Hosts.Masters }}
|
||||
{{ .Hostname }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
[kube_node]
|
||||
{{- range .Hosts }}
|
||||
{{- $search := "node" -}}
|
||||
{{- $found := false -}}
|
||||
{{- range .Roles }}
|
||||
{{- if eq . $search }}
|
||||
{{- $found = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $found }}
|
||||
{{ .Hostname }}
|
||||
{{- end }}
|
||||
{{- range .Hosts.Workers }}
|
||||
{{ .Hostname }}{{- if .Roles }} node_taints='[{{- range $i, $role := .Roles }}{{- if $i }},{{- end }}"node-role.kubernetes.io/{{ $role }}:NoSchedule"{{- end }}]' node_labels="{ {{- range $i, $role := .Roles }}{{- if $i }},{{- end }}'node-role.kubernetes.io/{{ $role }}': ''{{- end }} }"{{- end }}
|
||||
{{- end }}
|
||||
|
||||
[all:vars]
|
||||
|
||||
Reference in New Issue
Block a user