---
#$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
#$ chmod 700 get_helm.sh
#$ ./get_helm.sh

- name: Install required packages
  apt:
    name: "{{ item }}"
    update_cache: yes
    cache_valid_time: 3600
    state: latest
  with_items:
    - curl
    - bash-completion

- name: Fetch helm install script
  ansible.builtin.uri:
    url: https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
    return_content: yes
    creates: /usr/local/bin/helm
  register: helm_installer

- debug:
    var: helm_installer

- name: Run installer
  async: 300
  poll: 10
  ansible.builtin.shell:
    cmd: bash -s --
    stdin: "{{ helm_installer.content }}"
#    creates: /usr/local/bin/helm
  when: helm_installer.changed

