--- # Deploy kube-vip (control-plane HA VIP) via the k3s auto-deploy manifests dir. # k3s applies /var/lib/rancher/k3s/server/manifests/*.yaml on start, so this is # reproducible and independent of Flux. The same manifest is written on every # server so the DaemonSet survives the loss of any single node. - name: Detect the LAN interface holding the node's 192.168.1.5x address ansible.builtin.shell: >- set -o pipefail; ip -o -4 addr show | awk '/192\.168\.1\.5[0-2]\//{print $2; exit}' args: executable: /bin/bash register: kube_vip_iface_detect changed_when: false - name: Resolve the kube-vip VIP interface (override wins, else detected) ansible.builtin.set_fact: kube_vip_vip_interface: >- {{ kube_vip_interface if (kube_vip_interface | length > 0) else (kube_vip_iface_detect.stdout | trim) }} - name: Fail early if no LAN interface could be resolved ansible.builtin.assert: that: - kube_vip_vip_interface is defined - kube_vip_vip_interface | length > 0 fail_msg: >- Could not detect the 192.168.1.5x LAN interface for kube-vip on {{ inventory_hostname }} — set kube_vip_interface explicitly. - name: Ensure the k3s auto-deploy manifests directory exists ansible.builtin.file: path: "{{ kube_vip_manifest_path | dirname }}" state: directory owner: root group: root mode: "0700" - name: Template the kube-vip control-plane manifest (RBAC + DaemonSet) ansible.builtin.template: src: kube-vip.yaml.j2 dest: "{{ kube_vip_manifest_path }}" owner: root group: root mode: "0600"