Added seed code for caas-helm.
[ta/caas-helm.git] / ansible / roles / helm / tasks / main.yml
1 ---
2 # Copyright 2019 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 - name: Add tiller manifest template manifest
17   template:
18     src: tiller.yml
19     dest: "{{ caas.manifests_directory }}/tiller.yml"
20
21 - name: Add tiller service
22   template:
23     src: tiller-service.yml
24     dest: "{{ caas.manifests_directory }}/tiller-service.yml"
25
26 - name: create deployment api object
27   kubectl:
28     manifest: "{{ caas.manifests_directory }}/tiller.yml"
29     state: present
30   when: nodename | search("caas_master1")
31
32 - name: create tiller service
33   kubectl:
34     manifest: "{{ caas.manifests_directory }}/tiller-service.yml"
35     state: present
36   when: nodename | search("caas_master1")
37
38 - name: make env vars permanent
39   lineinfile:
40     dest: /etc/profile
41     state: present
42     line: "{{ item }}"
43     regexp: "{{ item }}"
44   with_items:
45     - "export HELM_HOST={{ caas.tiller_ip }}:{{ caas.tiller_port }}"
46     - "export HELM_HOME={{ caas.helm_home }}"
47   become_user: "root"
48
49 - name: make env vars permanent
50   lineinfile:
51     dest: /etc/environment
52     state: present
53     line: "{{ item }}"
54     regexp: "{{ item }}"
55   with_items:
56     - "HELM_HOST={{ caas.tiller_ip }}:{{ caas.tiller_port }}"
57     - "HELM_HOME={{ caas.helm_home }}"
58   become_user: "root"
59
60 - import_tasks: config.yml