summaryrefslogtreecommitdiffstats
path: root/ansible/roles/helm/tasks/main.yml
blob: 64db7850ff46d4b5b1995d2d3095bdf21e36af02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- name: Install Helm
  unarchive:
    src: "{{ app_data_path }}/downloads/helm-{{ helm_version }}-linux-amd64.tar.gz"
    dest: "{{ helm_bin_dir }}"
    extra_opts:
      - --strip=1
      - --wildcards
      - '*/helm'
    remote_src: true
    mode: 0755

- name: Install helm-push plugin if runing with Helm v3
  block:
    - name: Get helm environment information
      command: "{{ helm_bin_dir }}/helm env"
      register: helm_env
      changed_when: false  # for idempotency

    - name: Set helm plugin dir fact
      set_fact:
        helm_plugin_dir:
          "{% if 'HELM_PLUGINS' in helm_env.stdout -%}
           {{ (helm_env.stdout | replace('\"', '') | regex_search('HELM_PLUGINS.*')).split('=')[1] }}
           {%- else -%}
           {{ '~/.local/share/helm/plugins' }}
           {%- endif %}"

    - name: Ensure that plugin directory exists
      file:
        path: "{{ helm_plugin_dir }}/helm-push"
        state: directory
        mode: 0755

    - name: Deploy helm-push plugin
      unarchive:
        src: "{{ app_data_path }}/downloads/helm-push_{{ helm3_push_version }}_linux_amd64.tar.gz"
        dest: "{{ helm_plugin_dir }}/helm-push"
        remote_src: true
  when: helm_version | regex_search("^v3" )