This commit is contained in:
parent
33e58dcb83
commit
29a806227f
@ -38,6 +38,17 @@
|
|||||||
changed_when: False
|
changed_when: False
|
||||||
when: k3s_server | bool
|
when: k3s_server | bool
|
||||||
|
|
||||||
|
- name: Add node role label
|
||||||
|
k8s:
|
||||||
|
kind: "Node"
|
||||||
|
name: "{{ ansible_hostname }}"
|
||||||
|
kubeconfig: "{{ __k3s_config_dir }}/k3s.yaml"
|
||||||
|
state: present
|
||||||
|
definition:
|
||||||
|
metadata:
|
||||||
|
labels: "{{ (__k3s_node_lables['control'] if k3s_server | bool else __k3s_node_lables['worker']) | combine(__k3s_node_lables['general']) }}"
|
||||||
|
delegate_to: "{{ hostvars[k3s_server_nodes[0]]['inventory_hostname'] }}"
|
||||||
|
|
||||||
- name: Patch existing resources
|
- name: Patch existing resources
|
||||||
k8s:
|
k8s:
|
||||||
kind: "{{ item.kind }}"
|
kind: "{{ item.kind }}"
|
||||||
|
@ -18,3 +18,11 @@ __k3s_config_dir: /etc/rancher/k3s
|
|||||||
__k3s_data_dir: /var/lib/rancher/k3s
|
__k3s_data_dir: /var/lib/rancher/k3s
|
||||||
__k3s_manifests_dir: "{{ __k3s_data_dir }}/server/manifests"
|
__k3s_manifests_dir: "{{ __k3s_data_dir }}/server/manifests"
|
||||||
__k3s_log_dir: /var/log/rancher/k3s
|
__k3s_log_dir: /var/log/rancher/k3s
|
||||||
|
|
||||||
|
__k3s_node_lables:
|
||||||
|
general:
|
||||||
|
node-role.kubernetes.io/k3s-node: "true"
|
||||||
|
control:
|
||||||
|
node-role.kubernetes.io/control-plane: "true"
|
||||||
|
worker:
|
||||||
|
node-role.kubernetes.io/worker: "true"
|
||||||
|
Loading…
Reference in New Issue
Block a user