Packer.Images/ansible/roles/metacluster/tasks/components.yml
Danny Bessems 9eb5fbd0a3
All checks were successful
continuous-integration/drone/push Build is passing
Fix component name;Temporarily add ignore_errors
2022-06-26 21:35:41 +02:00

47 lines
1.7 KiB
YAML

- name: Create folder structure(s)
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- /opt/metacluster/components/harbor
- /opt/metacluster/helm-charts
- /opt/metacluster/container-images
- name: Add helm repositories
kubernetes.core.helm_repository:
name: "{{ item.name }}"
repo_url: "{{ item.url }}"
state: present
loop: "{{ platform.helm_repositories }}"
- name: Fetch helm charts
ansible.builtin.command:
cmd: helm fetch {{ item.value.helm.chart }} --untar --version {{ item.value.helm.version }}
chdir: /opt/metacluster/helm-charts
loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control:
label: "{{ item.key }}"
- name: Parse helm charts for container images
ansible.builtin.command:
cmd: "{{ item.value.helm.parse_logic }} /opt/metacluster/helm-charts/{{ item.key }}/values.yaml"
register: containerimages
loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control:
label: "{{ item.key }}"
- name: Pull and store containerimages
ansible.builtin.command:
cmd: skopeo copy docker://{{ item }} docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}.tar:{{ item }}
chdir: /opt/metacluster/container-images
ignore_errors: yes
loop: "{{ containerimages.results | map(attribute='stdout_lines') | flatten }}"
- name: Compress tarballs
community.general.archive:
dest: /opt/metacluster/container-images/{{ item | regex_findall('[^/:]+'))[-2] }}.tar.gz
path: /opt/metacluster/container-images/{{ item | regex_findall('[^/:]+'))[-2] }}.tar
remove: yes
ignore_errors: yes
loop: "{{ containerimages.results | map(attribute='stdout_lines') | flatten }}"