aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2025-07-09 19:29:30 +0200
committerclyhtsuriva <aimeric@adjutor.xyz>2025-07-09 19:29:30 +0200
commitb23b17896cbb3fa368b302bae96dd1183aad5374 (patch)
treecd03a8a22a3b82df66b1849817d286e6cb5314d4
parentca77065087fb7ee1b6a5bbad7948c65b8f02301e (diff)
ansible: install helm on k8s mastersHEADmaster
-rw-r--r--ansible/roles/k8s/tasks/install_helm.yml30
-rw-r--r--ansible/roles/k8s/tasks/main.yml4
2 files changed, 34 insertions, 0 deletions
diff --git a/ansible/roles/k8s/tasks/install_helm.yml b/ansible/roles/k8s/tasks/install_helm.yml
new file mode 100644
index 0000000..244950a
--- /dev/null
+++ b/ansible/roles/k8s/tasks/install_helm.yml
@@ -0,0 +1,30 @@
+---
+- name: Check if Helm is already installed
+ command: helm version --short
+ register: helm_installed
+ ignore_errors: true
+ changed_when: false
+
+- name: Download Helm install script
+ get_url:
+ url: https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
+ dest: /tmp/get_helm.sh
+ mode: '0755'
+ when: helm_installed is failed or helm_installed.rc != 0
+
+- name: Install Helm
+ command: /tmp/get_helm.sh
+ become: true
+ when: helm_installed is failed or helm_installed.rc != 0
+ register: helm_install_result
+ changed_when: "'Helm' in helm_install_result.stdout"
+
+- name: Verify Helm installation
+ command: helm version --short
+ register: helm_version
+ changed_when: false
+
+- name: Display Helm version
+ debug:
+ msg: "Helm {{ helm_version.stdout }} is installed"
+...
diff --git a/ansible/roles/k8s/tasks/main.yml b/ansible/roles/k8s/tasks/main.yml
index fb58c1b..b6234fa 100644
--- a/ansible/roles/k8s/tasks/main.yml
+++ b/ansible/roles/k8s/tasks/main.yml
@@ -9,4 +9,8 @@
- name: Install k3s on worker nodes
ansible.builtin.include_tasks: install_k3s_worker.yml
when: inventory_hostname in groups['tag_k3s_worker']
+
+- name: Install helm on master nodes
+ ansible.builtin.include_tasks: install_helm.yml
+ when: inventory_hostname in groups['tag_k3s_master']
...