Add application-install role 13/74913/1
authorTomas Levora <t.levora@partner.samsung.com>
Wed, 19 Dec 2018 13:36:36 +0000 (14:36 +0100)
committerTomáš Levora <t.levora@partner.samsung.com>
Wed, 19 Dec 2018 13:59:10 +0000 (14:59 +0100)
This role adds helm install handling to ansible installer

Change-Id: I31f62a815822f5375cc7e5b138bec27e359127b0
Issue-ID: OOM-1551
Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
ansible/roles/application-install/defaults/main.yml [new file with mode: 0644]
ansible/roles/application-install/tasks/install.yml [new file with mode: 0644]
ansible/roles/application-install/tasks/main.yml [new file with mode: 0644]

diff --git a/ansible/roles/application-install/defaults/main.yml b/ansible/roles/application-install/defaults/main.yml
new file mode 100644 (file)
index 0000000..473fbb8
--- /dev/null
@@ -0,0 +1 @@
+phase: install
diff --git a/ansible/roles/application-install/tasks/install.yml b/ansible/roles/application-install/tasks/install.yml
new file mode 100644 (file)
index 0000000..54b6443
--- /dev/null
@@ -0,0 +1,34 @@
+---
+- name: Helm init and upgrade
+  command: |
+     {{ helm_bin_dir }}/helm init
+     --upgrade
+     --skip-refresh
+
+- name: Wait for helm
+  wait_for: timeout=10
+  delegate_to: localhost
+
+- 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: Helm Make All
+  make:
+    chdir: "{{ app_helm_charts_directory }}"
+    target: all
+
+- name: Helm Install application {{ app_name }}
+  command: "helm install {{ helm_repository_name }}/{{ app_helm_chart_name }} --name {{ app_helm_release_name }} --namespace {{ app_kubernetes_namespace }}"
diff --git a/ansible/roles/application-install/tasks/main.yml b/ansible/roles/application-install/tasks/main.yml
new file mode 100644 (file)
index 0000000..3306d9e
--- /dev/null
@@ -0,0 +1,5 @@
+---
+- debug:
+    msg: "phase is {{ phase }}"
+
+- include_tasks: "{{ phase }}.yml"