[ANSIBLE] Fix 'application' role idempotency checks
[oom/offline-installer.git] / ansible / roles / application / tasks / install-helm-plugins.yml
1 ---
2 - name: Install helm plugins if needed
3   block:
4     - name: Get helm environment information
5       command: "{{ helm_bin_dir }}/helm env"
6       register: helm_env
7       changed_when: false
8     - name: Set helm data dir
9       set_fact:
10         helm_data_dir:
11           "{% if 'HELM_DATA_HOME' in helm_env.stdout -%}
12            {{ (helm_env.stdout | replace('\"', '') | regex_search('HELM_DATA_HOME.*')).split('=')[1] }}
13            {%- else -%}
14            {{ '~/.local/share/helm' }}
15            {%- endif %}"
16     - name: Ensure that dir for helm plugins exists
17       file:
18         path: "{{ helm_data_dir }}/plugins"
19         state: directory
20         mode: 0755
21     - name: Register all plugins to be inserted by dir names
22       find:
23         paths: "{{ app_helm_plugins_directory }}"
24         file_type: "directory"
25       register: list_of_plugins
26       delegate_to: localhost
27     - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir
28       copy:
29         src: "{{ item.path }}"
30         dest: "{{ helm_data_dir }}/plugins"
31         directory_mode: true
32         mode: 0755
33       loop: "{{ list_of_plugins.files }}"
34   when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none