---
- name: Add Helm repositories
  kubernetes.core.helm_repository: "{{ helm_repository_defaults | combine(item) }}"
  loop: "{{ repositories }}"

- name: Update Helm repositories
  kubernetes.core.helm:
    state: absent
    binary_path: "{{ bin_dir }}/helm"
    release_name: dummy  # trick needed to refresh in separate step
    release_namespace: kube-system
    update_repo_cache: true
  when: repositories != []

- name: Install Helm Applications
  kubernetes.core.helm: "{{ helm_defaults | combine(release_common_opts, item) }}"
  loop: "{{ releases }}"
