blob: 5246bf2f29c68cf8478b9d8add4c750f17365815 [file] [log] [blame]
---
- name: Helm init and upgrade
command: |
{{ helm_bin_dir }}/helm init
--upgrade
--skip-refresh
#A correct way to implement this would be using --wait option in helm init invocation.
#However, it does not work due to https://github.com/helm/helm/issues/4031 (fixed in newer helm release)
- name: "Wait for helm upgrade to finish"
command: "{{ helm_bin_dir }}/helm version --tiller-connection-timeout 10"
register: result
until: result.rc == 0
delay: 10
retries: 12
- name: Get all helm repos
command: "{{ helm_bin_dir }}/helm repo list"
register: repos
- name: Remove stable repo
command: "{{ helm_bin_dir }}/helm repo remove stable"
when: "'stable' in repos.stdout"
- name: Helm Serve
shell: "{{ helm_bin_dir }}/helm serve &"
async: 45
poll: 0
- name: Helm Add Repo
command: "{{ helm_bin_dir }}/helm repo add {{ helm_repository_name }} {{ helm_repository_url }}"
- name: Build local helm repository
make:
chdir: "{{ app_helm_charts_infra_directory }}"
target: "{{ item }}"
with_items: "{{ app_helm_build_targets }}"
environment:
PATH: "{{ helm_bin_dir }}:{{ ansible_env.PATH }}"
- name: Register root certificate
slurp:
src: '/certs/rootCA.crt'
register: root_cert
delegate_to: localhost
# WA: this is required because deploy plugin dont process params properly
- name: Create override file with global.cacert
copy:
dest: "{{ app_data_path}}/override.yaml"
content: |
global:
cacert:
{{ root_cert['content'] | b64decode | indent( width=4, indentfirst=False) }}
- name: Check for deploy plugin presence
stat:
path: '{{ helm_home_dir.stdout }}/plugins/deploy/deploy.sh'
register: deploy_plugin_presence
- name: "Helm Install application {{ app_name }}"
command: >
{{ helm_bin_dir }}/helm
{{ 'deploy' if deploy_plugin_presence.stat.exists else 'install --name' }}
{{ app_helm_release_name }}
{{ helm_repository_name }}/{{ app_helm_chart_name }}
--namespace {{ app_kubernetes_namespace }}
-f {{ app_data_path }}/override.yaml