From 36c30ca64641ad9f9dec880fb6286f383d824d41 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 18 Jul 2023 16:05:54 +0200 Subject: [PATCH] fix: Aggregate dictionary content within respective component task list --- .../roles/metacluster/tasks/json-server.yml | 23 ++++++++++++++++- ansible/vars/metacluster.yml | 25 +------------------ 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/json-server.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/json-server.yml index 38aa308..6793e04 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/json-server.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/json-server.yml @@ -1,4 +1,25 @@ - block: + - name: Aggregate manifest-component versions into dictionary + ansible.builtin.set_fact: + manifest_versions: "{{ manifest_versions | default([]) + [ item | combine( {'type': 'manifest', 'id': index } ) ] }}" + loop: + - name: cluster-api + versions: + management: + base: "{{ components.clusterapi.management.version.base }}" + cert_manager: "{{ components.clusterapi.management.version.cert_manager }}" + infrastructure_vsphere: "{{ components.clusterapi.management.version.infrastructure_vsphere }}" + ipam_incluster: "{{ components.clusterapi.management.version.ipam_incluster }}" + cpi_vsphere: "{{ components.clusterapi.management.version.cpi_vsphere }}" + workload: + calico: "{{ components.clusterapi.workload.version.calico }}" + k8s: "{{ components.clusterapi.workload.version.k8s }}" + - name: kube-vip + version: "{{ components.kubevip.version }}" + loop_control: + label: "{{ item.name }}" + index_var: index + - name: Install json-server chart kubernetes.core.helm: name: json-server @@ -13,7 +34,7 @@ combine( { 'jsonServer': { 'seedData': { - 'configInline': ( components['json-server'].chart_values.jsonServer.seedData.configInline | to_json ) + 'configInline': (components['json-server'].chart_values.jsonServer.seedData.configInline | combine( { 'components': manifest_versions } ) | to_json) } } } ) diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index 275f1b6..8cfe1e2 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -193,30 +193,7 @@ components: configInline: | { "appliance": { "version": "{{ appliance.version }}" }, - "components": [ - { "id": 0, - "name": "cluster-api", - "type": "manifest", - "versions": { - "management": { - "base": "{{ components.clusterapi.management.version.base }}", - "cert_manager": "{{ components.clusterapi.management.version.cert_manager }}", - "infrastructure_vsphere": "{{ components.clusterapi.management.version.infrastructure_vsphere }}", - "ipam_incluster": "{{ components.clusterapi.management.version.ipam_incluster }}", - "cpi_vsphere": "{{ components.clusterapi.management.version.cpi_vsphere }}" - }, - "workload": { - "calico": "{{ components.clusterapi.workload.version.calico }}", - "k8s": "{{ components.clusterapi.workload.version.k8s }}" - } - } - }, - { "id": 1, - "name": "kube-vip", - "type": "manifest", - "version": "{{ components.kubevip.version }}" - } - ], + "components": [], "healthz": { "status": "running" } } sidecar: