# Create directory to deploy kube-vip manifest
- name: Create directory for Kube VIP Manifest
  ansible.builtin.file:
    path: "/var/lib/rancher/rke2/server/manifests"
    state: directory
    mode: "0755"
  when: inventory_hostname in groups['servers']

# Copy kube-vip to server 1 manifest folder for auto deployment at bootstrap
- name: Deploy Kube VIP Configuration
  ansible.builtin.template:
    src: templates/kube-vip-config.j2
    dest: /var/lib/rancher/rke2/server/manifests/kube-vip.yaml
    owner: root
    group: root
    mode: "0644"
  when: inventory_hostname == groups['servers'][0]
