Move Helm v2 plugin installation logic into separate playbook 62/117062/3
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Fri, 22 Jan 2021 12:04:42 +0000 (13:04 +0100)
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>
Tue, 26 Jan 2021 08:33:48 +0000 (08:33 +0000)
Change-Id: Icc767450da832d8792b7bdf33f85e5ffc97ee435
Issue-ID: OOM-2665
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
ansible/roles/application/molecule/custom_role/molecule.yml
ansible/roles/application/molecule/default/molecule.yml
ansible/roles/application/molecule/ubuntu/molecule.yml
ansible/roles/application/tasks/install-helm2-plugins.yml [new file with mode: 0644]
ansible/roles/application/tasks/transfer-helm-charts.yml

index f9b29d9..eeea94b 100644 (file)
@@ -29,6 +29,7 @@ provisioner:
         app_helm_chart_name: "{{ app_name }}"
         application_pre_install_role: application/test-patch-role
         application_post_install_role: application/test-patch-role
+        helm_version: v2
   lint:
     name: ansible-lint
   playbooks:
index 30c752e..9d4102b 100644 (file)
@@ -27,6 +27,7 @@ provisioner:
           - all
           - onap
         app_helm_chart_name: "{{ app_name }}"
+        helm_version: v2
   lint:
     name: ansible-lint
 scenario:
index 2fde35a..8552ce5 100644 (file)
@@ -28,6 +28,7 @@ provisioner:
           - all
           - onap
         app_helm_chart_name: "{{ app_name }}"
+        helm_version: v2
   lint:
     name: ansible-lint
   playbooks:
diff --git a/ansible/roles/application/tasks/install-helm2-plugins.yml b/ansible/roles/application/tasks/install-helm2-plugins.yml
new file mode 100644 (file)
index 0000000..f1f900e
--- /dev/null
@@ -0,0 +1,25 @@
+---
+- name: Install helm plugins if needed
+  block:
+    - name: Get helm dir
+      command: "{{ helm_bin_dir }}/helm home"
+      register: helm_home_dir
+    - name: Ensure that dir for helm plugins exists
+      file:
+        path: "{{ helm_home_dir.stdout }}/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
+      delegate_to: localhost
+    - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir
+      copy:
+        src: "{{ item.path }}"
+        dest: "{{ helm_home_dir.stdout }}/plugins"
+        directory_mode: true
+        mode: 0755
+      loop: "{{ list_of_plugins.files }}"
+  when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none
index 56c95cc..ac91073 100644 (file)
         src: "{{ app_helm_charts_install_directory }}.tgz"
         dest: "{{ app_helm_charts_infra_directory }}"
 
-
-- name: Install helm plugins if needed
-  block:
-    - name: Get helm dir
-      command: "{{ helm_bin_dir }}/helm home"
-      register: helm_home_dir
-    - name: Ensure that dir for helm plugins exists
-      file:
-        path: "{{ helm_home_dir.stdout }}/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
-      delegate_to: localhost
-    - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir
-      copy:
-        src: "{{ item.path }}"
-        dest: "{{ helm_home_dir.stdout }}/plugins"
-        directory_mode: true
-        mode: 0755
-      loop: "{{ list_of_plugins.files }}"
-  when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none
+- include_tasks: install-helm2-plugins.yml
+  when: helm_version | regex_search("^v2" )