-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetanotation.yaml
More file actions
66 lines (61 loc) · 2.09 KB
/
setanotation.yaml
File metadata and controls
66 lines (61 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- name: Konfiguriere OVN-Kubernetes Annotationen für Nodes
hosts: primary # Nur auf dem Primary-Node ausführen
vars:
ansible_python_interpreter: /usr/bin/python3
become: yes
gather_facts: false # Wir sammeln nur die benötigten Fakten
tasks:
- name: Sammle Fakten über die Secondary Nodes
delegate_to: "{{ item }}"
ansible.builtin.setup:
filter: ansible_default_ipv4.macaddress # Nur MAC-Adresse sammeln
with_items: "{{ groups['secondary'] }}"
- name: Setze node-chassis-id Annotation
kubernetes.core.k8s:
api_version: v1
kind: Node
name: "{{ item }}"
state: present
merge_type: merge
resource_definition:
metadata:
annotations:
k8s.ovn.org/node-chassis-id: "{{ item }}"
with_items: "{{ groups['secondary'] }}"
loop_control:
loop_var: item
environment:
KUBECONFIG: /var/lib/microshift/resources/kubeadmin/kubeconfig
- name: Setze macAddress Annotation
kubernetes.core.k8s:
api_version: v1
kind: Node
name: "{{ item }}"
state: present
merge_type: merge
resource_definition:
metadata:
annotations:
macAddress: "{{ hostvars[item]['ansible_default_ipv4']['macaddress'] }}"
with_items: "{{ groups['secondary'] }}"
loop_control:
loop_var: item
environment:
KUBECONFIG: /var/lib/microshift/resources/kubeadmin/kubeconfig
- name: Setze l3-gateway-config Annotation
kubernetes.core.k8s:
api_version: v1
kind: Node
name: "{{ item }}"
state: present
merge_type: merge
resource_definition:
metadata:
annotations:
k8s.ovn.org/l3-gateway-config: "{{ {'default': {'mode': 'local', 'mac-address': hostvars[item]['ansible_default_ipv4']['macaddress']}} | to_json }}"
with_items: "{{ groups['secondary'] }}"
loop_control:
loop_var: item
environment:
KUBECONFIG: /var/lib/microshift/resources/kubeadmin/kubeconfig