blob: c0be12eb1e0a3f2301ea5180c9c92d485045a924 [file] [log] [blame]
Tomas Levora5ea00a92018-12-19 14:36:36 +01001---
2- name: Helm init and upgrade
3 command: |
4 {{ helm_bin_dir }}/helm init
5 --upgrade
6 --skip-refresh
7
Michal Ptacek11e2af52018-12-19 19:42:03 +00008#A correct way to implement this would be using --wait option in helm init invocation.
9#However, it does not work due to https://github.com/helm/helm/issues/4031 (fixed in newer helm release)
10- name: "Wait for helm upgrade to finish"
11 command: "{{ helm_bin_dir }}/helm version --tiller-connection-timeout 10"
12 register: result
13 until: result.rc == 0
14 delay: 10
15 retries: 12
Tomas Levora5ea00a92018-12-19 14:36:36 +010016
17- name: Get all helm repos
18 command: "{{ helm_bin_dir }}/helm repo list"
19 register: repos
20
21- name: Remove stable repo
22 command: "{{ helm_bin_dir }}/helm repo remove stable"
23 when: "'stable' in repos.stdout"
24
25- name: Helm Serve
26 shell: "{{ helm_bin_dir }}/helm serve &"
27 async: 45
28 poll: 0
29
30- name: Helm Add Repo
31 command: "{{ helm_bin_dir }}/helm repo add {{ helm_repository_name }} {{ helm_repository_url }}"
32
Michal Ptacek271cf3f2019-01-17 20:39:46 +000033- name: Build local helm repository
Tomas Levora5ea00a92018-12-19 14:36:36 +010034 make:
Michal Ptacek11e2af52018-12-19 19:42:03 +000035 chdir: "{{ app_helm_charts_infra_directory }}"
Michal Ptacek271cf3f2019-01-17 20:39:46 +000036 target: "{{ item }}"
37 with_items: "{{ app_helm_build_targets }}"
Michal Ptacek11e2af52018-12-19 19:42:03 +000038 environment:
39 PATH: "{{ helm_bin_dir }}:{{ ansible_env.PATH }}"
Tomas Levora5ea00a92018-12-19 14:36:36 +010040
Michal Ptacek997057f2019-02-01 08:37:05 +000041- name: Register root certificate
42 slurp:
43 src: '/certs/rootCA.crt'
44 register: root_cert
45 delegate_to: localhost
46
47# WA: this is required because deploy plugin dont process params properly
48- name: Create override file with global.cacert
49 copy:
50 dest: "{{ app_data_path}}/override.yaml"
51 content: |
52 global:
Michal Ptacek04f2ca62019-02-15 12:58:57 +000053 cacert: |
Michal Ptacek997057f2019-02-01 08:37:05 +000054 {{ root_cert['content'] | b64decode | indent( width=4, indentfirst=False) }}
55
Michal Ptacekfabcad62019-02-04 06:38:08 +000056- name: Check for deploy plugin presence
57 stat:
Milan Verespej5f5aa012019-02-08 15:30:39 +010058 path: '{{ helm_home_dir.stdout }}/plugins/deploy/deploy.sh'
Michal Ptacekfabcad62019-02-04 06:38:08 +000059 register: deploy_plugin_presence
60
61- name: "Helm Install application {{ app_name }}"
62 command: >
63 {{ helm_bin_dir }}/helm
64 {{ 'deploy' if deploy_plugin_presence.stat.exists else 'install --name' }}
65 {{ app_helm_release_name }}
66 {{ helm_repository_name }}/{{ app_helm_chart_name }}
67 --namespace {{ app_kubernetes_namespace }}
Michal Ptacek997057f2019-02-01 08:37:05 +000068 -f {{ app_data_path }}/override.yaml