2022-06-24 22:50:44 +00:00
|
|
|
- name: Create folder structure(s)
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
loop:
|
2022-06-26 15:54:19 +00:00
|
|
|
- /opt/metacluster/helm-charts
|
2022-06-26 16:24:57 +00:00
|
|
|
- /opt/metacluster/container-images
|
2022-06-24 21:55:54 +00:00
|
|
|
|
2022-06-30 09:20:39 +00:00
|
|
|
|
2022-06-24 22:50:44 +00:00
|
|
|
- name: Add helm repositories
|
|
|
|
kubernetes.core.helm_repository:
|
2022-06-24 22:54:36 +00:00
|
|
|
name: "{{ item.name }}"
|
2022-06-24 22:50:44 +00:00
|
|
|
repo_url: "{{ item.url }}"
|
|
|
|
state: present
|
2022-06-26 15:54:19 +00:00
|
|
|
loop: "{{ platform.helm_repositories }}"
|
|
|
|
|
|
|
|
- name: Fetch helm charts
|
|
|
|
ansible.builtin.command:
|
2022-06-26 19:20:16 +00:00
|
|
|
cmd: helm fetch {{ item.value.helm.chart }} --untar --version {{ item.value.helm.version }}
|
2022-06-26 15:54:19 +00:00
|
|
|
chdir: /opt/metacluster/helm-charts
|
|
|
|
loop: "{{ lookup('ansible.builtin.dict', components) }}"
|
2022-06-26 18:56:45 +00:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.key }}"
|
2022-06-26 15:54:19 +00:00
|
|
|
|
2022-07-04 11:26:35 +00:00
|
|
|
- name: Inject chart values into ansible var files
|
2022-07-04 14:45:09 +00:00
|
|
|
ansible.builtin.blockinfile:
|
2022-07-04 11:26:35 +00:00
|
|
|
path: /opt/firstboot/ansible/vars/metacluster.yml
|
2022-07-05 07:56:56 +00:00
|
|
|
block: |
|
2022-07-04 11:26:35 +00:00
|
|
|
{{ item.key }}:
|
2022-07-05 07:56:56 +00:00
|
|
|
{{ item.value.helm.chart_values | default(omit) }}
|
2022-07-04 15:35:02 +00:00
|
|
|
marker: "# {mark} ANSIBLE MANAGED BLOCK -- {{ item.key }}"
|
2022-07-04 11:26:35 +00:00
|
|
|
loop: "{{ lookup('ansible.builtin.dict', components) }}"
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.key }}"
|
|
|
|
|
2022-06-26 16:24:57 +00:00
|
|
|
- name: Parse helm charts for container images
|
2022-06-27 07:56:48 +00:00
|
|
|
ansible.builtin.shell:
|
2022-06-27 10:27:11 +00:00
|
|
|
cmd: "{{ item.value.helm.parse_logic }}"
|
2022-06-27 17:43:07 +00:00
|
|
|
chdir: /opt/metacluster/helm-charts/{{ item.key }}
|
2022-06-26 16:24:57 +00:00
|
|
|
register: containerimages
|
|
|
|
loop: "{{ lookup('ansible.builtin.dict', components) }}"
|
2022-06-26 18:56:45 +00:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.key }}"
|
2022-06-26 15:54:19 +00:00
|
|
|
|
2022-06-29 11:07:34 +00:00
|
|
|
- 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
|
2022-07-04 15:08:46 +00:00
|
|
|
register: imagedownload
|
|
|
|
until: imagedownload is succeeded
|
2022-07-04 15:10:15 +00:00
|
|
|
retries: 5
|
2022-07-01 11:10:26 +00:00
|
|
|
loop: "{{ containerimages.results | map(attribute='stdout_lines') | flatten + dependencies.container_images }}"
|
2022-06-26 16:32:05 +00:00
|
|
|
|
2022-06-29 11:07:34 +00:00
|
|
|
- name: Compress tarballs
|
|
|
|
community.general.archive:
|
|
|
|
dest: /opt/metacluster/container-images/image-tarballs.tgz
|
|
|
|
path: /opt/metacluster/container-images/*
|
|
|
|
format: gz
|
|
|
|
remove: yes
|