Write full manifest
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-04-20 16:17:28 +02:00
parent d9b07235eb
commit 2769cff893
2 changed files with 23 additions and 9 deletions

View File

@ -116,17 +116,28 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
clustertoken: "{{ k3s_token.content | b64decode | trim }}" clustertoken: "{{ k3s_token.content | b64decode | trim }}"
- name: Pull 'kube-vip' image - name: Install 'kube-vip'
block:
- name: Retrieve manifest for RBAC
ansible.builtin.uri:
url: https://kube-vip.io/manifests/rbac.yaml
return_content: yes
register: manifest_rbac
- name: Pull image
ansible.builtin.shell: ansible.builtin.shell:
cmd: ctr image pull ghcr.io/kube-vip/kube-vip:latest cmd: ctr image pull ghcr.io/kube-vip/kube-vip:latest
- name: Generate manifest for daemonSet - name: Generate manifest for daemonSet
ansible.builtin.shell: ansible.builtin.shell:
cmd: "ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:latest vip /kube-vip manifest daemonset --interface {{ ansible_interfaces | difference(['lo']) }} --address {{ cluster.virtualip | ansible.utils.ipaddr('address') }} --inCluster --taint --controlplane --services --arp --leaderElection" cmd: "ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:latest vip /kube-vip manifest daemonset --interface {{ ansible_default_ipv4.interface }} --address {{ cluster.virtualip | ansible.utils.ipaddr('address') }} --inCluster --taint --controlplane --services --arp --leaderElection"
register: manifest register: manifest_daemonset
- ansible.builtin.debug: - name: Inject manifest for installation
var: manifest ansible.builtin.template:
src: kube-vip.j2
dest: /var/lib/rancher/k3s/server/manifests/kube-vip.yml
when: inventory_hostname == ansible_play_hosts[0] when: inventory_hostname == ansible_play_hosts[0]

3
templates/kube-vip.j2 Normal file
View File

@ -0,0 +1,3 @@
{{ manifest_rbac.content }}
---
{{ manifest_daemonset.stdout }}