-
Notifications
You must be signed in to change notification settings - Fork 76
/
33_install_metalLB.yml
42 lines (39 loc) · 1.62 KB
/
33_install_metalLB.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
- name: Prepare cluster to install metalLB
hosts: vm_host
run_once: true
vars_files:
- vars/k8s_cluster.yml
tasks:
- name: Configure MetalLB
when: metallb.install_metallb
block:
- name: Render template for L2 configuration
ansible.builtin.template:
src: templates/metallb-l2.j2
dest: /tmp/{{ k8s.cluster_name | default('k8s-test', true) }}/metallb-l2.yml
mode: "0755"
- name: Download MetalLB CR for later apply
ansible.builtin.get_url:
url: "{{ item.url }}"
dest: "{{ item.name }}"
mode: "0664"
loop:
- name: /tmp/{{ k8s.cluster_name | default('k8s-test', true) }}/metallb.yml
url: "{{ metallb_setup.manifest_url }}/metallb-native.yaml"
- name: Ensure MetalLB is installed in your cluster
kubernetes.core.k8s:
state: present
src: "{{ item }}"
kubeconfig: "{{ workspace_directory.base_path }}/clusters/{{ k8s.cluster_name | default('k8s-test', true) }}/admin.kubeconfig"
apply: true
wait: true
loop:
- /tmp/{{ k8s.cluster_name | default('k8s-test', true) }}/metallb.yml
- name: Ensure MetalLB configuration CRD is added in your cluster
kubernetes.core.k8s:
state: present
src: "/tmp/{{ k8s.cluster_name | default('k8s-test', true) }}/metallb-l2.yml"
kubeconfig: "{{ workspace_directory.base_path }}/clusters/{{ k8s.cluster_name | default('k8s-test', true) }}/admin.kubeconfig"
wait: true
apply: true