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 | 997057f | 2019-02-01 08:37:05 +0000 | [diff] [blame] | 41 | - 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 Ptacek | 04f2ca6 | 2019-02-15 12:58:57 +0000 | [diff] [blame^] | 53 | cacert: | |
Michal Ptacek | 997057f | 2019-02-01 08:37:05 +0000 | [diff] [blame] | 54 | {{ root_cert['content'] | b64decode | indent( width=4, indentfirst=False) }} |
| 55 | |
Michal Ptacek | fabcad6 | 2019-02-04 06:38:08 +0000 | [diff] [blame] | 56 | - name: Check for deploy plugin presence |
| 57 | stat: |
Milan Verespej | 5f5aa01 | 2019-02-08 15:30:39 +0100 | [diff] [blame] | 58 | path: '{{ helm_home_dir.stdout }}/plugins/deploy/deploy.sh' |
Michal Ptacek | fabcad6 | 2019-02-04 06:38:08 +0000 | [diff] [blame] | 59 | 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 Ptacek | 997057f | 2019-02-01 08:37:05 +0000 | [diff] [blame] | 68 | -f {{ app_data_path }}/override.yaml |