This commit is contained in:
		| @@ -4,6 +4,7 @@ | ||||
|     state: directory | ||||
|   loop: | ||||
|     - /opt/metacluster/helm-charts | ||||
|     - /opt/metacluster/manifests | ||||
|     - /opt/metacluster/container-images | ||||
|  | ||||
| - name: Add helm repositories | ||||
| @@ -45,6 +46,29 @@ | ||||
|   loop_control: | ||||
|     label: "{{ item.key }}" | ||||
|  | ||||
| - block: | ||||
|  | ||||
|     - name: Retrieve Cluster-API manifests | ||||
|       ansible.builtin.command: | ||||
|         cmd: clusterctl config repositories | awk '/CoreProvider|kubeadm|vsphere/ {print $(NF-1)"download/"$NF}' | ||||
|       register: clusterapi_manifests | ||||
|  | ||||
|     - name: Download manifests | ||||
|       ansible.builtin.get_url: | ||||
|         url: "{{ item }}" | ||||
|         dest: "/opt/metacluster/manifests/{{ item | basename }}" | ||||
|       loop: "{{ clusterapi_manifests.stdout_lines }}" | ||||
|  | ||||
|     - name: Parse manifests | ||||
|       ansible.builtin.shell: | ||||
|         cmd: cat {{ item }} | yq --no-doc eval '.. | .image? | select(.)' | awk '!/ /' | sort | ||||
|       register: parsedmanifests | ||||
|       loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/manifests/*.yaml') | sort }}" | ||||
|  | ||||
|     - name: Store container images | ||||
|       ansible.builtin.set_fact: | ||||
|         clusterapi_containerimages: parsedmanifests.results | json_query('results[*].stdout') | ||||
|  | ||||
| - name: Pull and store containerimages | ||||
|   ansible.builtin.shell: | ||||
|     cmd: >- | ||||
| @@ -54,7 +78,7 @@ | ||||
|         docker://{{ item }} \ | ||||
|         docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}.tar:{{ item }} | ||||
|     chdir: /opt/metacluster/container-images | ||||
|   loop: "{{ ((containerimages.results | map(attribute='stdout_lines') | flatten) + dependencies.container_images) | unique }}" | ||||
|   loop: "{{ ((containerimages.results | map(attribute='stdout_lines') | flatten) + dependencies.container_images + clusterapi_containerimages) | unique }}" | ||||
|  | ||||
| # - name: Inject manifests | ||||
| #   ansible.builtin.template: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user