This commit is contained in:
parent
d9b07235eb
commit
2769cff893
21
playbook.yml
21
playbook.yml
@ -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
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