Aggregate/store workload cluster chart values
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Danny Bessems 2023-04-04 22:44:56 +02:00
parent 86a0b684e2
commit 979ac38794
3 changed files with 26 additions and 8 deletions

View File

@ -8,14 +8,6 @@
loop_control:
label: "{{ item.key }}"
# - name: Aggregate chart_values into dict
# ansible.builtin.set_fact:
# workloadcluster_chartvalues: "{{ workloadcluster_chartvalues | default({}) | combine({ (item.key | regex_replace('[^A-Za-z0-9]', '')): { 'chart_values': (item.value.chart_values | from_yaml) } }) }}"
# when: item.value.chart_values is defined
# loop: "{{ lookup('ansible.builtin.dict', downstream.helm_charts) }}"
# loop_control:
# label: "{{ item.key }}"
- name: Write dict to vars_file
ansible.builtin.copy:
dest: /opt/firstboot/ansible/vars/metacluster.yml
@ -28,6 +20,23 @@
} | to_nice_yaml(indent=2, width=4096)
}}
- name: Aggregate chart_values into dict
ansible.builtin.set_fact:
workloadcluster_chartvalues: "{{ workloadcluster_chartvalues | default({}) | combine({ (item.key | regex_replace('[^A-Za-z0-9]', '')): { 'chart_values': (item.value.chart_values | from_yaml) } }) }}"
when: item.value.chart_values is defined
loop: "{{ lookup('ansible.builtin.dict', downstream.helm_charts) }}"
loop_control:
label: "{{ item.key }}"
- name: Write dict to vars_file
ansible.builtin.copy:
dest: /opt/firstboot/ansible/vars/workloadcluster.yml
content: >-
{{
{ 'downstream_components': ( workloadcluster_chartvalues )
} | to_nice_yaml(indent=2, width=4096)
}}
- name: Download ClusterAPI manifests
ansible.builtin.get_url:
url: "{{ item.url }}"

View File

@ -5,6 +5,7 @@
vars_files:
- defaults.yml
- metacluster.yml
- workloadcluster.yml
# become: true
roles:
- vapp

View File

@ -13,6 +13,14 @@
loop_control:
label: "{{ item.path | basename }}"
- name: Write chart values to file
ansible.builtin.copy:
dest: /opt/workloadcluster/git-repositories/gitops/values/{{ item.key }}/values.yaml
content: "{{ item.value.chart_values }}"
loop: "{{ lookup('ansible.builtin.dict', downstream_components) }}"
loop_control:
label: "{{ item.key }}"
- name: Initialize/Push git repository
ansible.builtin.shell:
cmd: |