diff options
Diffstat (limited to 'ansible')
-rwxr-xr-x | ansible/docker/build_ansible_image.sh | 10 | ||||
-rwxr-xr-x | ansible/group_vars/all.yml | 12 | ||||
-rw-r--r-- | ansible/roles/application-install/tasks/install.yml | 5 | ||||
-rw-r--r-- | ansible/roles/application-install/tasks/pre-install.yml | 22 |
4 files changed, 41 insertions, 8 deletions
diff --git a/ansible/docker/build_ansible_image.sh b/ansible/docker/build_ansible_image.sh index d54ddc43..49833be5 100755 --- a/ansible/docker/build_ansible_image.sh +++ b/ansible/docker/build_ansible_image.sh @@ -27,14 +27,12 @@ image_name="${2:-ansible:latest}" script_path=$(readlink -f "$0") script_dir=$(dirname "$script_path") -git_commit=$(git rev-parse --revs-only HEAD) +git_commit=$(git rev-parse --revs-only HEAD || true) build_date=$(date -I) -if [ -z "$ansible_version" ]; then - docker build "$script_dir" -t "${image_name}" --label "git-commit=$git_commit" --label "build-date=$build_date" -else - docker build "$script_dir" -t "${image_name}" --label "git-commit=$git_commit" --label "build-date=$build_date" --build-arg ansible_version="$ansible_version" -fi +docker build "$script_dir" -t "${image_name}" --label "build-date=$build_date" \ + ${git_commit:+--label git-commit=${git_commit}} \ + ${ansible_version:+--build-arg ansible_version=${ansible_version}} # Export docker image into chroot and tararchive it. It takes ~40M of space and is packaged together with sw. if "${script_dir}"/create_docker_chroot.sh convert "${image_name}" "${script_dir}"/ansible_chroot ; then diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 425f4f14..0a73b637 100755 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -105,6 +105,18 @@ app_helm_charts_infra_directory: # e.g. app_helm_chart_name: onap app_helm_chart_name: +# Targets for helm charts repository build +# e.g. for ONAP Casablanca +# app_helm_build_targets: +# - all +# - onap +app_helm_build_targets: + +# Directory with helm plugins +# It's an optional parameter used e.g. in OOM Casablanca +# app_helm_plugins_directory: "{{ app_helm_charts_infra_directory}}/kubernetes/helm/plugins/" +app_helm_plugins_directory: + # Helm release name (visible in POD names) used by Helm # e.g. app_helm_release_name: "{{ project_configuration }}" app_helm_release_name: diff --git a/ansible/roles/application-install/tasks/install.yml b/ansible/roles/application-install/tasks/install.yml index 7ff6b62c..d385b448 100644 --- a/ansible/roles/application-install/tasks/install.yml +++ b/ansible/roles/application-install/tasks/install.yml @@ -30,10 +30,11 @@ - name: Helm Add Repo command: "{{ helm_bin_dir }}/helm repo add {{ helm_repository_name }} {{ helm_repository_url }}" -- name: Helm Make All +- name: Build local helm repository make: chdir: "{{ app_helm_charts_infra_directory }}" - target: all + target: "{{ item }}" + with_items: "{{ app_helm_build_targets }}" environment: PATH: "{{ helm_bin_dir }}:{{ ansible_env.PATH }}" diff --git a/ansible/roles/application-install/tasks/pre-install.yml b/ansible/roles/application-install/tasks/pre-install.yml index b782ca76..88a95ea6 100644 --- a/ansible/roles/application-install/tasks/pre-install.yml +++ b/ansible/roles/application-install/tasks/pre-install.yml @@ -17,7 +17,29 @@ src: "{{ app_helm_charts_install_directory }}.tgz" dest: "{{ app_helm_charts_infra_directory }}" + +- name: Install helm plugins if needed + block: + - name: Ensure that dir for helm plugins exists + file: + path: "~/.helm/plugins" + state: directory + mode: 0755 + - name: Register all plugins to be inserted by dir names + find: + paths: "{{ app_helm_plugins_directory }}" + file_type: "directory" + register: list_of_plugins + - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir + command: "{{ helm_bin_dir }}/helm plugin install {{ item.path }}" + with_items: "{{ list_of_plugins.files }}" + register: helm_plugin_install_result + failed_when: "helm_plugin_install_result.rc > 0 and helm_plugin_install_result.stderr != 'Error: plugin already exists'" + become: true + when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none + - name: "Execute custome role {{ application_pre_install_role }} if defined." include_tasks: custom_role.yml vars: application_custom_role: "{{ application_pre_install_role }}" + |