Added seed code for caas-helm.
[ta/caas-helm.git] / ansible / roles / helm / tasks / config.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: create the necessary directories
17   file:
18     path: "{{ item }}"
19     state: directory
20   with_items:
21     - "{{ caas.helm_home }}/repository"
22     - "{{ caas.helm_home }}/repository/local"
23
24 - name: allowing cloud_admin_user to access helm_home folder recursively
25   acl:
26     path:  "{{ caas.helm_home }}"
27     entity: "{{ users.admin_user_name }}"
28     etype: user
29     permissions: rwx
30     state: present
31     recursive: yes
32     default: yes
33   become_user: "root"
34
35 - name: applies the effective rights mask to the helm_home folder recursively
36   acl:
37     path:  "{{ caas.helm_home }}"
38     etype: mask
39     permissions: rwx
40     state: present
41     recursive: yes
42     default: yes
43   become_user: "root"
44
45 - name: touch the repository file
46   copy:
47     content: ""
48     owner: "{{ users.admin_user_name }}"
49     group: "{{ users.admin_user_name }}"
50     dest: "{{ caas.helm_home }}/repository/repositories.yaml"
51
52 - name: create the local repository file
53   copy:
54     content: |
55       apiVersion: v1
56       entries: {}
57     owner: "{{ users.admin_user_name }}"
58     group: "{{ users.admin_user_name }}"
59     dest: "{{ caas.helm_home }}/repository/local/index.yaml"
60
61 - name: init helm
62   shell: "HELM_HOME={{ caas.helm_home }} helm init -c --skip-refresh"
63
64 - name: add the chart-repo to helm repositories
65   shell: "HELM_HOME={{ caas.helm_home }} /usr/bin/helm repo add default {{ caas.chart_repo }}/charts"
66   register: res
67   until: res.stdout | search('has been added to your repositories')
68   retries: 3
69   delay: 5