summaryrefslogtreecommitdiffstats
path: root/ansible/roles/application-install/tasks/pre-install.yml
blob: 3d63cb559108fd5db000d9b6ad0dffdd79ca6074 (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
41
42
43
44
45
---
# before custom specific code is executed we need to move helm charts to infra
- name: Distribute helm charts to infra node
  block:
    - name: Archive helm charts
      archive:
        path: "{{ app_helm_charts_install_directory }}/*"
        dest: "{{ app_helm_charts_install_directory }}.tgz"
      delegate_to: localhost
    - name: Create helm charts dir on infra
      file:
        path: "{{ app_helm_charts_infra_directory }}"
        state: directory
        mode: 0755
    - name: Unarchive helm charts on infra node
      unarchive:
        src: "{{ app_helm_charts_install_directory }}.tgz"
        dest: "{{ app_helm_charts_infra_directory }}"


- name: Install helm plugins if needed
  block:
     - name: Ensure that dir for helm plugins exists
       file:
         path: "~/.helm/plugins"
         state: directory
         mode: 0755
     - name: Register all plugins to be inserted by dir names
       find:
         paths: "{{ app_helm_plugins_directory }}"
         file_type: "directory"
       register: list_of_plugins
     - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir
       command: "{{ helm_bin_dir }}/helm plugin install {{ item.path }}"
       with_items: "{{ list_of_plugins.files }}"
       register: helm_plugin_install_result
       failed_when: "helm_plugin_install_result.rc > 0 and helm_plugin_install_result.stderr != 'Error: plugin already exists'"
  become: true
  when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none

- name: "Execute custom role {{ application_pre_install_role }} if defined."
  include_tasks: custom_role.yml
  vars:
    application_custom_role: "{{ application_pre_install_role }}"