diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-02-16 13:12:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-02-16 13:12:45 +0000 |
commit | 9880331a27a67063d802c67b2ecf95c677046406 (patch) | |
tree | 22eca98787a905c85e5cc842d2db40f1328d5b7b /ansible/roles/application/tasks/install.yml | |
parent | 8ec40e9842c856ed4c14d91755cc26b7c81b8f01 (diff) | |
parent | d6908ed39dd5e58c539c1c818f371849dd0271eb (diff) |
Merge changes from topic "ansible-helm3"
* changes:
Run chartmuseum as a docker container
Update 'helm deploy' failure criteria
Fix kubeconfig file permissions
Ensure k8s namespace for ONAP exists
Customize helm "--timeout" option format if running helm v3
Redirect chartmuseum stdout/stderr to /dev/null
Drop DIND specific test env settings for 'rke' role/playbook
Improve bin utils symlink creation logic
Add test scenario for Helm v3
Refactor Helm role test setup
Add helm-push Helm v3 plugin to downloaded utilities list
Fix Helm v3 data dir setup
Add tasks to setup Helm v3 on infra node
Add Helm v3 test scenario to rke playbook tests
Change 'rke' role testing strategy
Workaround RKE binary download issue
Play 'chartmuseum' role in rke playbook if running with Helm v3
Fix variable inclusion order in RKE playbook tests
Add Helm v3.3.4 to the list of downloaded utilities
Add 'chartmuseum' binary to downloaded utilities list
Add Molecule test scenario to verify 'chartmuseum' role on Ubuntu
Add 'chartmuseum' role
Split Helm v2 setup to separate playbook
Improve 'application' role test coverage
Diffstat (limited to 'ansible/roles/application/tasks/install.yml')
-rw-r--r-- | ansible/roles/application/tasks/install.yml | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/ansible/roles/application/tasks/install.yml b/ansible/roles/application/tasks/install.yml index 9e27e2de..2db88631 100644 --- a/ansible/roles/application/tasks/install.yml +++ b/ansible/roles/application/tasks/install.yml @@ -1,51 +1,4 @@ --- -- name: Helm init and upgrade - command: | - {{ helm_bin_dir }}/helm init - --upgrade - --skip-refresh - changed_when: true # init is always changed type of action - -# 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 - changed_when: false # for idempotency - -- name: Get all helm repos - command: "{{ helm_bin_dir }}/helm repo list" - register: repos - changed_when: false # for idempotency - -- name: Remove stable repo - command: "{{ helm_bin_dir }}/helm repo remove stable" - changed_when: true # when executed its a changed type of action - when: "'stable' in repos.stdout" - -- name: Helm Serve - shell: "{{ helm_bin_dir }}/helm serve &" - async: 45 - poll: 3 # wait 3sec to get a chance for some stderr - register: helm_serve - changed_when: "'address already in use' not in helm_serve.stderr" - -- name: List helm repos - command: "{{ helm_bin_dir }}/helm repo list" - register: helm_repo_list - changed_when: false # for idempotency - failed_when: - - helm_repo_list.rc > 0 - - "'Error: no repositories to show' not in helm_repo_list.stderr" - -- name: Helm Add Repo - command: "{{ helm_bin_dir }}/helm repo add {{ helm_repository_name | mandatory }} {{ helm_repository_url | mandatory }}" - when: "'local' not in helm_repo_list.stdout" - changed_when: true # when executed its a changed type of action - # Make utility is missing in Ubuntu by default and it's necessary for building local helm repository - name: Install build-essential package: @@ -53,6 +6,11 @@ state: present when: ansible_os_family == "Debian" +- include_tasks: setup-helm2.yml + when: helm_version | regex_search("^v2" ) +- include_tasks: setup-helm3.yml + when: helm_version | regex_search("^v3" ) + - name: Build local helm repository make: chdir: "{{ app_helm_charts_infra_directory }}" @@ -78,10 +36,11 @@ debug: var: helm_override_files -- include_tasks: setup-helm2.yml - when: helm_version | regex_search("^v2" ) -- include_tasks: setup-helm3.yml - when: helm_version | regex_search("^v3" ) +- name: "Ensure kubernetes namespace for {{ app_name }} exists" + command: kubectl create namespace {{ app_kubernetes_namespace }} + register: kubectl_out + changed_when: kubectl_out.rc == 0 + failed_when: kubectl_out.rc == 1 and "AlreadyExists" not in kubectl_out.stderr - name: "Helm Install application {{ app_name }}" command: > @@ -94,4 +53,4 @@ {{ helm_extra_install_options | map(attribute='opt') | join(' ') }} changed_when: true # when executed its a changed type of action register: helm_install - failed_when: helm_install.stderr + failed_when: "'FAILED' in (helm_install.stdout | upper()) or helm_install.rc != 0" |