From 22c06e23887635964d40195e476802cdb82c083c Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 7 Nov 2022 01:57:30 +0100 Subject: [PATCH] Fix loop var;Fix template vars --- .../roles/metacluster/tasks/components.yml | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/ansible/roles/metacluster/tasks/components.yml b/ansible/roles/metacluster/tasks/components.yml index 73e5811..998d8f1 100644 --- a/ansible/roles/metacluster/tasks/components.yml +++ b/ansible/roles/metacluster/tasks/components.yml @@ -71,20 +71,17 @@ loop_control: label: "{{ item.url | basename }}" - - debug: - var: clusterapi_manifests - # - name: Parse manifests - # ansible.builtin.shell: - # cmd: cat {{ item | basename }} | yq --no-doc eval '.. | .image? | select(.)' | awk '!/ /' | sort - # chdir: /opt/metacluster/manifests - # register: parsedmanifests - # loop: "{{ clusterapi_manifests.stdout_lines | sort }}" - # loop_control: - # label: "{{ item | basename }}" + - name: Parse manifests + ansible.builtin.shell: + cmd: cat {{ item.dest }} | yq --no-doc eval '.. | .image? | select(.)' | awk '!/ /' | sort + register: parsedmanifests + loop: "{{ clusterapi_manifests.results | sort }}" + loop_control: + label: "{{ item | basename }}" - # - name: Store container images - # ansible.builtin.set_fact: - # clusterapi_containerimages: "{{ parsedmanifests | json_query('results[*].stdout') }}" + - name: Store container images + ansible.builtin.set_fact: + clusterapi_containerimages: "{{ parsedmanifests | json_query('results[*].stdout') }}" - name: Configure clusterctl ansible.builtin.template: @@ -93,12 +90,12 @@ vars: _template: hv: - fqdn: vapp['hv.fqdn'] - username: vapp['hv.username'] - password: vapp['hv.password'] + fqdn: "{{ vapp['hv.fqdn'] }}" + username: "{{ vapp['hv.username'] }}" + password: "{{ vapp['hv.password'] }}" version: - base: components.clusterapi.manifest.version.base - infrastructure_vsphere: components.clusterapi.manifest.version.infrastructure_vsphere + base: "{{ components.clusterapi.manifest.version.base }}" + infrastructure_vsphere: "{{ components.clusterapi.manifest.version.infrastructure_vsphere }}" - name: Parse helm charts for container images ansible.builtin.shell: