From d39d594bf05ea6e90c4c517403eed79fa6cc19ec Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 26 Jun 2022 17:54:19 +0200 Subject: [PATCH] Reorganize vars dict;Parse & loop through dict key/values --- .../roles/appliance/tasks/dependencies.yml | 2 ++ .../roles/metacluster/tasks/components.yml | 17 ++++++++++++++++- ansible/vars/metacluster.yml | 19 +++++++++++-------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ansible/roles/appliance/tasks/dependencies.yml b/ansible/roles/appliance/tasks/dependencies.yml index bf07893..f7ecc56 100644 --- a/ansible/roles/appliance/tasks/dependencies.yml +++ b/ansible/roles/appliance/tasks/dependencies.yml @@ -13,6 +13,8 @@ group: root mode: 0755 loop: "{{ dependencies.static_binaries | selectattr('archive', 'undefined') }}" + loop_control: + label: "{{ item.filename }}" - name: Download, extract & install archived static binaries include_tasks: dependencies.archive_compressed.yml diff --git a/ansible/roles/metacluster/tasks/components.yml b/ansible/roles/metacluster/tasks/components.yml index 85ac66a..06efb23 100644 --- a/ansible/roles/metacluster/tasks/components.yml +++ b/ansible/roles/metacluster/tasks/components.yml @@ -4,10 +4,25 @@ state: directory loop: - /opt/metacluster/components/harbor + - /opt/metacluster/helm-charts - name: Add helm repositories kubernetes.core.helm_repository: name: "{{ item.name }}" repo_url: "{{ item.url }}" state: present - loop: "{{ components.helm_repositories }}" + loop: "{{ platform.helm_repositories }}" + +- name: Fetch helm charts + ansible.builtin.command: + cmd: helm fetch {{ item.value.chart_name }} --untar --version {{ item.value.version }} + chdir: /opt/metacluster/helm-charts + loop: "{{ lookup('ansible.builtin.dict', components) }}" + +- ansible.builtin.command: + cmd: ls -lashR /opt/metacluster/helm-charts + register: results +- ansible.builtin.debug: + var: results + + diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index ec54e16..61f950a 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -1,7 +1,6 @@ -k3s: - version: v1.24.1+k3s1 - -components: +platform: + k3s: + version: v1.24.1+k3s1 helm_repositories: - name: longhorn @@ -9,14 +8,18 @@ components: - name: harbor url: https://helm.goharbor.io +components: + longhorn: - version: + version: 1.3.0 + helm_chart: longhorn/longhorn harbor: - version: + version: 2.5.1 + helm_chart: harbor/harbor - argocd: - version: +# argocd: +# version: dependencies: