This commit is contained in:
parent
d9b07235eb
commit
2769cff893
29
playbook.yml
29
playbook.yml
@ -116,17 +116,28 @@
|
||||
ansible.builtin.set_fact:
|
||||
clustertoken: "{{ k3s_token.content | b64decode | trim }}"
|
||||
|
||||
- name: Pull 'kube-vip' image
|
||||
ansible.builtin.shell:
|
||||
cmd: ctr image pull ghcr.io/kube-vip/kube-vip:latest
|
||||
- name: Install 'kube-vip'
|
||||
block:
|
||||
|
||||
- name: Generate manifest for daemonSet
|
||||
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"
|
||||
register: manifest
|
||||
- name: Retrieve manifest for RBAC
|
||||
ansible.builtin.uri:
|
||||
url: https://kube-vip.io/manifests/rbac.yaml
|
||||
return_content: yes
|
||||
register: manifest_rbac
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: manifest
|
||||
- name: Pull image
|
||||
ansible.builtin.shell:
|
||||
cmd: ctr image pull ghcr.io/kube-vip/kube-vip:latest
|
||||
|
||||
- name: Generate manifest for daemonSet
|
||||
ansible.builtin.shell:
|
||||
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_daemonset
|
||||
|
||||
- name: Inject manifest for installation
|
||||
ansible.builtin.template:
|
||||
src: kube-vip.j2
|
||||
dest: /var/lib/rancher/k3s/server/manifests/kube-vip.yml
|
||||
|
||||
when: inventory_hostname == ansible_play_hosts[0]
|
||||
|
||||
|
3
templates/kube-vip.j2
Normal file
3
templates/kube-vip.j2
Normal file
@ -0,0 +1,3 @@
|
||||
{{ manifest_rbac.content }}
|
||||
---
|
||||
{{ manifest_daemonset.stdout }}
|
Loading…
Reference in New Issue
Block a user