2021-01-09 17:54:42 +00:00
|
|
|
- set_fact:
|
|
|
|
metallb_combined_values: "{{ metallb_default_values | combine(metallb_values, recursive=true) }}"
|
|
|
|
|
|
|
|
- name: Deploy MetalLB
|
2022-07-12 13:48:14 +00:00
|
|
|
kubernetes.core.helm:
|
2021-01-09 17:54:42 +00:00
|
|
|
create_namespace: true
|
|
|
|
release_namespace: "{{ metallb_namespace | default('metallb-system') }}"
|
|
|
|
release_name: "{{ metallb_name | default('metallb') }}"
|
2023-06-10 03:20:10 +00:00
|
|
|
chart_ref: "{{ metallb_chart_ref }}"
|
2021-01-09 17:54:42 +00:00
|
|
|
chart_version: "{{ metallb_version | default(omit) }}"
|
|
|
|
release_values: "{{ metallb_combined_values | from_yaml }}"
|
|
|
|
wait: true
|
|
|
|
|
|
|
|
- name: Check for strict arp
|
|
|
|
check_mode: false
|
|
|
|
shell: |
|
|
|
|
kubectl get configmap kube-proxy -n kube-system -o yaml | \
|
|
|
|
sed -e "s/strictARP: false/strictARP: true/" | \
|
|
|
|
kubectl diff -f - -n kube-system
|
|
|
|
register: check_strict_arp
|
2023-06-10 03:20:10 +00:00
|
|
|
when: metallb_strict_arp
|
2021-01-09 17:54:42 +00:00
|
|
|
changed_when: check_strict_arp.rc != 0
|
|
|
|
|
|
|
|
- name: Apply strict arp
|
|
|
|
shell: |
|
|
|
|
kubectl get configmap kube-proxy -n kube-system -o yaml | \
|
|
|
|
sed -e "s/strictARP: false/strictARP: true/" | \
|
|
|
|
kubectl apply -f - -n kube-system \
|
|
|
|
&& kubectl -n kube-system delete pods --selector=k8s-app=kube-proxy
|
|
|
|
when:
|
|
|
|
- strict_arp_for_metallb
|
2023-06-10 03:20:10 +00:00
|
|
|
- metallb_strict_arp.changed
|
2022-07-12 13:48:14 +00:00
|
|
|
|
|
|
|
- name: Apply MetalLB L2 definitions
|
|
|
|
k8s:
|
|
|
|
state: present
|
|
|
|
definition:
|
|
|
|
"{{ item.value }}"
|
|
|
|
wait: true
|
|
|
|
loop: "{{ metallb_bgp_definitions | dict2items }}"
|
|
|
|
when: metallb_advertisement_type == 'L2'
|
|
|
|
|
|
|
|
- name: Apply MetalLB BGP definitions
|
|
|
|
k8s:
|
|
|
|
state: present
|
|
|
|
definition:
|
|
|
|
"{{ item.value }}"
|
|
|
|
wait: true
|
|
|
|
loop: "{{ metallb_bgp_definitions | dict2items }}"
|
|
|
|
when: metallb_advertisement_type == 'BGP'
|
|
|
|
|