[deploy-env] Do not use kubernetes.core ansible module

It fails with the error: `No module named 'yaml'`.
So let's use native helm with the ansible shell instead.

Change-Id: If652d603cfcaeb0b70c9b566b90d98e627d3bada
This commit is contained in:
Vladimir Kozhukalov 2025-03-11 13:11:13 -05:00
parent e599421b0b
commit c8e87da4ae
2 changed files with 18 additions and 21 deletions

View File

@ -1,20 +1,17 @@
---
- name: Add Flannel Helm repo
become: false
become_user: "{{ kubectl.user }}"
when: inventory_hostname in (groups['primary'] | default([]))
block:
- name: Add Flannel chart repo
kubernetes.core.helm_repository:
name: flannel
repo_url: "https://flannel-io.github.io/flannel/"
shell: |
helm repo add flannel https://flannel-io.github.io/flannel/
- name: Install Flannel
kubernetes.core.helm:
name: flannel
chart_ref: flannel/flannel
namespace: kube-flannel
create_namespace: true
chart_version: "{{ flannel_version }}"
release_values:
podCidr: "{{ kubeadm.pod_network_cidr }}"
shell: |
helm upgrade --install flannel flannel/flannel \
--version {{ flannel_version }} \
--namespace kube-flannel \
--create-namespace \
--set podCidr="{{ kubeadm.pod_network_cidr }}"
...

View File

@ -16,17 +16,17 @@
when: inventory_hostname in (groups['primary'] | default([]))
block:
- name: Add MetalLB chart repo
kubernetes.core.helm_repository:
name: metallb
repo_url: "https://metallb.github.io/metallb"
become_user: "{{ kubectl.user }}"
shell: |
helm repo add metallb https://metallb.github.io/metallb
- name: Install MetalLB
kubernetes.core.helm:
name: metallb
chart_ref: metallb/metallb
chart_version: "{{ metallb_version }}"
namespace: metallb-system
create_namespace: true
become_user: "{{ kubectl.user }}"
shell: |
helm upgrade --install metallb metallb/metallb \
--version {{ metallb_version }} \
--namespace metallb-system \
--create-namespace
- name: Sleep before trying to check MetalLB pods
pause: