--- - name: Ensure metallb-system namespace exists kubernetes.core.k8s: name: metallb-system api_version: v1 kind: Namespace state: present tags: - metallb - namespace - name: Download MetalLB manifest ansible.builtin.get_url: url: "{{ metallb_manifest_url }}" dest: "/tmp/metallb.yaml" mode: "0644" validate_certs: true run_once: true tags: - metallb - download - name: Apply MetalLB core manifests kubernetes.core.k8s: src: "/tmp/metallb.yaml" state: present namespace: metallb-system tags: - metallb - apply_manifest - name: Create IPAddressPool for MetalLB kubernetes.core.k8s: state: present namespace: metallb-system definition: "{{ lookup('ansible.builtin.template', 'ipaddresspool.yml.j2') | from_yaml }}" tags: - metallb - ip_pool - name: Create L2Advertisement for MetalLB kubernetes.core.k8s: state: present namespace: metallb-system definition: "{{ lookup('ansible.builtin.template', 'l2advertisement.yml.j2') | from_yaml }}" tags: - metallb - l2_advertisement - name: Setup DNS on Netcup community.general.netcup_dns: api_key: "{{ netcup_api_key }}" api_password: "{{ netcup_api_password }}" customer_id: "{{ netcup_customer_id }}" domain: "{{ domain }}" name: "{{ service.name }}.k3s" type: "A" value: "{{ service.ip }}" loop: "{{ services }}" loop_control: loop_var: service delegate_to: localhost