Tomas Levora | 5ea00a9 | 2018-12-19 14:36:36 +0100 | [diff] [blame] | 1 | --- |
| 2 | - name: Helm init and upgrade |
| 3 | command: | |
| 4 | {{ helm_bin_dir }}/helm init |
| 5 | --upgrade |
| 6 | --skip-refresh |
| 7 | |
Michal Ptacek | 11e2af5 | 2018-12-19 19:42:03 +0000 | [diff] [blame] | 8 | #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 Levora | 5ea00a9 | 2018-12-19 14:36:36 +0100 | [diff] [blame] | 16 | |
| 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 Ptacek | 271cf3f | 2019-01-17 20:39:46 +0000 | [diff] [blame] | 33 | - name: Build local helm repository |
Tomas Levora | 5ea00a9 | 2018-12-19 14:36:36 +0100 | [diff] [blame] | 34 | make: |
Michal Ptacek | 11e2af5 | 2018-12-19 19:42:03 +0000 | [diff] [blame] | 35 | chdir: "{{ app_helm_charts_infra_directory }}" |
Michal Ptacek | 271cf3f | 2019-01-17 20:39:46 +0000 | [diff] [blame] | 36 | target: "{{ item }}" |
| 37 | with_items: "{{ app_helm_build_targets }}" |
Michal Ptacek | 11e2af5 | 2018-12-19 19:42:03 +0000 | [diff] [blame] | 38 | environment: |
| 39 | PATH: "{{ helm_bin_dir }}:{{ ansible_env.PATH }}" |
Tomas Levora | 5ea00a9 | 2018-12-19 14:36:36 +0100 | [diff] [blame] | 40 | |
Michal Ptacek | fabcad6 | 2019-02-04 06:38:08 +0000 | [diff] [blame] | 41 | - name: Check for deploy plugin presence |
| 42 | stat: |
| 43 | path: '~/.helm/plugins/deploy/deploy.sh' |
| 44 | register: deploy_plugin_presence |
| 45 | |
| 46 | - name: "Helm Install application {{ app_name }}" |
| 47 | command: > |
| 48 | {{ helm_bin_dir }}/helm |
| 49 | {{ 'deploy' if deploy_plugin_presence.stat.exists else 'install --name' }} |
| 50 | {{ app_helm_release_name }} |
| 51 | {{ helm_repository_name }}/{{ app_helm_chart_name }} |
| 52 | --namespace {{ app_kubernetes_namespace }} |