summaryrefslogtreecommitdiffstats
path: root/ansible/roles/application
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/application')
-rw-r--r--ansible/roles/application/.gitignore1
-rw-r--r--ansible/roles/application/defaults/main.yml14
l---------ansible/roles/application/molecule/custom_role/Dockerfile.j21
-rw-r--r--ansible/roles/application/molecule/custom_role/molecule.yml55
l---------ansible/roles/application/molecule/custom_role/tests1
-rw-r--r--ansible/roles/application/molecule/default/cleanup.yml6
-rw-r--r--ansible/roles/application/molecule/default/molecule.yml2
-rw-r--r--ansible/roles/application/molecule/default/tests/test_default.py3
-rw-r--r--ansible/roles/application/tasks/install.yml12
-rw-r--r--ansible/roles/application/tasks/transfer-helm-charts.yml2
10 files changed, 86 insertions, 11 deletions
diff --git a/ansible/roles/application/.gitignore b/ansible/roles/application/.gitignore
deleted file mode 100644
index 155cbb20..00000000
--- a/ansible/roles/application/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-application/
diff --git a/ansible/roles/application/defaults/main.yml b/ansible/roles/application/defaults/main.yml
index 2ae668ac..6a7472a6 100644
--- a/ansible/roles/application/defaults/main.yml
+++ b/ansible/roles/application/defaults/main.yml
@@ -5,11 +5,15 @@ helm_extra_install_options:
- { opt: '--timeout 1800'}
# Override file generation for Helm application can be customized by any role
# given by user and found by ansible from roles_path.
-# By default override file is generated by 'application-override' role that is
-# specific for offline installer (for onap) as it's generating server
-# certificate needed to simulate internet by offline installer.
+# By default override file is generated by 'application-override' role that
+# allows specifying custom helm overrides as the value of "override"
+# dictionary in inventory or extravars.
app_skip_helm_override: false
app_helm_override_role: application-override
app_helm_override_file: "{{ app_data_path }}/override.yaml"
-helm_overide_files:
- - "{{ app_helm_override_file }}"
+# List of additional helm override files, the one generated above overrides
+# every file listed here. In addition, the order of override files in this list
+# matters, settings in latter files override the former..
+# Paths provided here must be absolute.
+helm_override_files:
+ - "{{ app_helm_charts_infra_directory }}/onap/resources/overrides/onap-all.yaml"
diff --git a/ansible/roles/application/molecule/custom_role/Dockerfile.j2 b/ansible/roles/application/molecule/custom_role/Dockerfile.j2
new file mode 120000
index 00000000..867ec5c3
--- /dev/null
+++ b/ansible/roles/application/molecule/custom_role/Dockerfile.j2
@@ -0,0 +1 @@
+../default/Dockerfile.j2 \ No newline at end of file
diff --git a/ansible/roles/application/molecule/custom_role/molecule.yml b/ansible/roles/application/molecule/custom_role/molecule.yml
new file mode 100644
index 00000000..f9b29d92
--- /dev/null
+++ b/ansible/roles/application/molecule/custom_role/molecule.yml
@@ -0,0 +1,55 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance
+ image: centos:7
+provisioner:
+ name: ansible
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ inventory:
+ group_vars:
+ all:
+ app_name: moleculetestapp
+ app_data_path: "/opt/{{ app_name }}"
+ app_helm_release_name: "{{ app_name }}"
+ app_kubernetes_namespace: "{{ app_name }}"
+ app_helm_charts_install_directory: application/helm_charts
+ app_helm_plugins_directory: "{{ app_helm_charts_install_directory}}/helm/plugins/"
+ app_helm_charts_infra_directory: "{{ app_data_path }}/helm_charts"
+ helm_bin_dir: /usr/local/bin
+ app_helm_build_targets:
+ - all
+ - onap
+ app_helm_chart_name: "{{ app_name }}"
+ application_pre_install_role: application/test-patch-role
+ application_post_install_role: application/test-patch-role
+ lint:
+ name: ansible-lint
+ playbooks:
+ prepare: ../default/prepare.yml
+ converge: ../default/playbook.yml
+ cleanup: ../default/cleanup.yml
+scenario:
+ name: custom_role
+ test_sequence:
+ - lint
+ - cleanup
+ - destroy
+ - dependency
+ - syntax
+ - create
+ - prepare
+ - converge
+ - verify
+ - cleanup
+ - destroy
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/ansible/roles/application/molecule/custom_role/tests b/ansible/roles/application/molecule/custom_role/tests
new file mode 120000
index 00000000..b8ac4407
--- /dev/null
+++ b/ansible/roles/application/molecule/custom_role/tests
@@ -0,0 +1 @@
+../default/tests/ \ No newline at end of file
diff --git a/ansible/roles/application/molecule/default/cleanup.yml b/ansible/roles/application/molecule/default/cleanup.yml
new file mode 100644
index 00000000..996acaf1
--- /dev/null
+++ b/ansible/roles/application/molecule/default/cleanup.yml
@@ -0,0 +1,6 @@
+---
+- name: Cleanup infra
+ hosts: all
+ ignore_unreachable: true
+ roles:
+ - cleanup-application
diff --git a/ansible/roles/application/molecule/default/molecule.yml b/ansible/roles/application/molecule/default/molecule.yml
index 8f19d7ff..30c752e2 100644
--- a/ansible/roles/application/molecule/default/molecule.yml
+++ b/ansible/roles/application/molecule/default/molecule.yml
@@ -27,8 +27,6 @@ provisioner:
- all
- onap
app_helm_chart_name: "{{ app_name }}"
- application_pre_install_role:
- application_post_install_role:
lint:
name: ansible-lint
scenario:
diff --git a/ansible/roles/application/molecule/default/tests/test_default.py b/ansible/roles/application/molecule/default/tests/test_default.py
index 5edceff3..22298e3a 100644
--- a/ansible/roles/application/molecule/default/tests/test_default.py
+++ b/ansible/roles/application/molecule/default/tests/test_default.py
@@ -16,7 +16,8 @@ serve
repo list
repo add local http://127.0.0.1:8879
install --name moleculetestapp local/moleculetestapp --namespace \
-moleculetestapp -f /opt/moleculetestapp/override.yaml \
+moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
+overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
--timeout 1800"""
assert fc == expected_content
diff --git a/ansible/roles/application/tasks/install.yml b/ansible/roles/application/tasks/install.yml
index 003631d7..2ac2fd6b 100644
--- a/ansible/roles/application/tasks/install.yml
+++ b/ansible/roles/application/tasks/install.yml
@@ -59,6 +59,16 @@
name: "{{ app_helm_override_role }}"
when: not app_skip_helm_override
+# The generated override file is added to override list unless skipped.
+- name: Add application helm override file to list of overrides unless skipped
+ set_fact:
+ helm_override_files: "{{ (helm_override_files | default([])) + [app_helm_override_file] }}"
+ when: not app_skip_helm_override
+
+- name: Print final list of override files
+ debug:
+ var: helm_override_files
+
- name: Check for deploy plugin presence
stat:
path: '{{ helm_home_dir.stdout }}/plugins/deploy/deploy.sh'
@@ -71,7 +81,7 @@
{{ app_helm_release_name }}
{{ helm_repository_name }}/{{ app_helm_chart_name }}
--namespace {{ app_kubernetes_namespace }}
- {% if not app_skip_helm_override %} {% for arg in helm_overide_files %} {{ '-f ' + arg }} {% endfor %} {% endif %}
+ {% for arg in helm_override_files %} {{ '-f ' + arg }} {% endfor %}
{% for arg in helm_extra_install_options %} {{ arg.opt }} {% endfor %}
changed_when: true # when executed its a changed type of action
register: helm_install
diff --git a/ansible/roles/application/tasks/transfer-helm-charts.yml b/ansible/roles/application/tasks/transfer-helm-charts.yml
index 0cd7c02f..5e4240b6 100644
--- a/ansible/roles/application/tasks/transfer-helm-charts.yml
+++ b/ansible/roles/application/tasks/transfer-helm-charts.yml
@@ -40,5 +40,5 @@
dest: "{{ helm_home_dir.stdout }}/plugins"
directory_mode: true
mode: 0755
- with_items: "{{ list_of_plugins.files }}"
+ loop: "{{ list_of_plugins.files }}"
when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none