Added seed code for caas-helm.
[ta/caas-helm.git] / ansible / roles / helm / tasks / main.yml
diff --git a/ansible/roles/helm/tasks/main.yml b/ansible/roles/helm/tasks/main.yml
new file mode 100644 (file)
index 0000000..17d4117
--- /dev/null
@@ -0,0 +1,60 @@
+---
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+- name: Add tiller manifest template manifest
+  template:
+    src: tiller.yml
+    dest: "{{ caas.manifests_directory }}/tiller.yml"
+
+- name: Add tiller service
+  template:
+    src: tiller-service.yml
+    dest: "{{ caas.manifests_directory }}/tiller-service.yml"
+
+- name: create deployment api object
+  kubectl:
+    manifest: "{{ caas.manifests_directory }}/tiller.yml"
+    state: present
+  when: nodename | search("caas_master1")
+
+- name: create tiller service
+  kubectl:
+    manifest: "{{ caas.manifests_directory }}/tiller-service.yml"
+    state: present
+  when: nodename | search("caas_master1")
+
+- name: make env vars permanent
+  lineinfile:
+    dest: /etc/profile
+    state: present
+    line: "{{ item }}"
+    regexp: "{{ item }}"
+  with_items:
+    - "export HELM_HOST={{ caas.tiller_ip }}:{{ caas.tiller_port }}"
+    - "export HELM_HOME={{ caas.helm_home }}"
+  become_user: "root"
+
+- name: make env vars permanent
+  lineinfile:
+    dest: /etc/environment
+    state: present
+    line: "{{ item }}"
+    regexp: "{{ item }}"
+  with_items:
+    - "HELM_HOST={{ caas.tiller_ip }}:{{ caas.tiller_port }}"
+    - "HELM_HOME={{ caas.helm_home }}"
+  become_user: "root"
+
+- import_tasks: config.yml