diff --git a/roles/k3s_server_post/defaults/main.yml b/roles/k3s_server_post/defaults/main.yml index 578e55711..ec4d74d36 100644 --- a/roles/k3s_server_post/defaults/main.yml +++ b/roles/k3s_server_post/defaults/main.yml @@ -30,3 +30,4 @@ metal_lb_mode: layer2 metal_lb_available_timeout: 240s metal_lb_controller_tag_version: v0.14.3 metal_lb_ip_range: 192.168.30.80-192.168.30.90 +metal_lb_interfaces: diff --git a/roles/k3s_server_post/meta/main.yml b/roles/k3s_server_post/meta/main.yml index f9fc83d5f..b48130eed 100644 --- a/roles/k3s_server_post/meta/main.yml +++ b/roles/k3s_server_post/meta/main.yml @@ -129,6 +129,10 @@ argument_specs: description: MetalLB ip range for load balancer default: 192.168.30.80-192.168.30.90 + metal_lb_interfaces: + description: MetalLB interfaces to announce on. By default, announces on all interfaces. + default: + metal_lb_controller_tag_version: description: Image tag for MetalLB default: v0.14.3 diff --git a/roles/k3s_server_post/templates/metallb.crs.j2 b/roles/k3s_server_post/templates/metallb.crs.j2 index 562f561fa..0cf917a06 100644 --- a/roles/k3s_server_post/templates/metallb.crs.j2 +++ b/roles/k3s_server_post/templates/metallb.crs.j2 @@ -21,6 +21,13 @@ kind: L2Advertisement metadata: name: default namespace: metallb-system +{% if metal_lb_interfaces %} +spec: + interfaces: + {% for interface in metal_lb_interfaces %} + - {{ interface }} + {% endfor %} +{% endif %} {% endif %} {% if metal_lb_mode == "bgp" %} ---