2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
20 - name: Load execution mode variables
21 include_vars: "{{ execution_mode }}.yaml"
24 - name: Create directories for helm repositories
26 path: "{{ item.path }}"
27 state: "{{ item.state }}"
29 - {path: "{{ engine_workspace }}/offline/charts/stable", state: absent}
30 - {path: "{{ engine_workspace }}/offline/charts/stable", state: directory}
31 - {path: "{{ engine_workspace }}/offline/charts/local", state: absent}
32 - {path: "{{ engine_workspace }}/offline/charts/local", state: directory}
34 - name: Place index.yaml to webserver stable charts repository
37 dest: "{{ engine_workspace }}/offline/charts/stable/index.yaml"
39 when: execution_mode == "offline-deployment"
41 - name: Initialize Helm
42 command: helm init --client-only --local-repo-url {{ local_repo_url }} --stable-repo-url {{ stable_repo_url }}
43 register: helm_init_result
46 - name: Clone Helm Charts repository
48 repo: "{{ helm_charts_git_url }}"
49 dest: "{{ config_path }}/repos/charts"
50 version: "{{ charts_version }}"
54 http_proxy: "{{ lookup('env','http_proxy') }}"
55 https_proxy: "{{ lookup('env','https_proxy') }}"
56 no_proxy: "{{ lookup('env','no_proxy') }}"
58 - name: Generate values.yaml
61 dest: "{{ config_path }}/repos/charts/stable/prometheus/values.yaml"
64 - name: Remove previous installations of Prometheus
66 helm delete --purge "{{ prometheus_service }}"
71 - name: Remove Prometheus namespace
73 kubectl delete ns "{{ prometheus_namespace }}"
78 - name: Create Prometheus namespace
85 name: "{{ prometheus_namespace }}"
87 - name: Install Prometheus using helm
90 --name "{{ prometheus_service }}"
91 --namespace "{{ prometheus_namespace }}"
93 {{ config_path }}/repos/charts/stable/prometheus
94 register: prometheus_helm_log
97 - name: Log Prometheus helm output to console
99 msg: "{{ prometheus_helm_log.stdout_lines }}"
101 - name: Wait until Prometheus pods are available
104 namespace: "{{ prometheus_namespace }}"
106 - "app = {{ prometheus_service }}"
108 - status.phase=Running
109 register: prometheus_pod_status
111 - prometheus_pod_status.resources is defined
112 - prometheus_pod_status.resources
116 - name: Install Prometheus LoadBalancer service
119 definition: "{{ lookup('template', 'prometheus_service.yaml.j2') }}"
120 register: prometheus_service_status
122 - name: Log Prometheus service information to console
125 - "------------------------------"
126 - "Prometheus Service information"
127 - "------------------------------"
128 - "clusterIP: {{ prometheus_service_status.result.spec.clusterIP }}"
129 - "targetPort: {{ prometheus_service_status.result.spec.ports[0].targetPort }}"
130 - "nodePort: {{ prometheus_service_status.result.spec.ports[0].nodePort }}"
131 - "------------------------------"
133 # vim: set ts=2 sw=2 expandtab: