Write whole dict to file
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-07-09 23:37:57 +02:00
parent abacbf90ce
commit 0b97ae2fc5
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1 @@
#jinja2:variable_start_string:'[%' , variable_end_string:'%]' #jinja2:variable_start_string:'[%' , variable_end_string:'%]'
components:

View File

@ -25,13 +25,19 @@
- name: Aggregate chart_values into dict - name: Aggregate chart_values into dict
ansible.builtin.set_fact: ansible.builtin.set_fact:
chart_values: "{{ chart_values | default({}) | combine({ item.key: { 'chart_values': (item.value.helm.chart_values | default('~')) } }) }}" chart_values: "{{ chart_values | default({}) | combine({ item.key: { 'chart_values': item.value.helm.chart_values } }) }}"
when: item.value.helm.chart_values is defined
loop: "{{ lookup('ansible.builtin.dict', components) }}" loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"
- ansible.builtin.debug: - ansible.builtin.debug:
msg: "{{ chart_values | to_nice_yaml }}" msg: "{{ chart_values | to_nice_yaml(default_style='\"', indent=2, width=4096) }}"
- name: Write dict to vars_file
ansible.builtin.blockinfile:
path: /opt/firstboot/ansible/vars/metacluster.yml
block: "{{ { 'components': chart_values } | to_nice_yaml(default_style='\"', indent=2, width=4096) }}"
- name: Parse helm charts for container images - name: Parse helm charts for container images
ansible.builtin.shell: ansible.builtin.shell: