mmistretta
2020-02-25 d732bfe211220fcd877f496d0db941a857ece6ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
- name: Create operator
  k8s:
    state: present
    namespace: "{{ _namespace }}"
    definition: "{{ lookup('file', role_path ~ '/files/grafana/operator.yml' ) | from_yaml }}"
 
- name: Wait until csv/{{ _grafana_csv_version }} is Succeeded
  command: >
    oc get csv/{{ _grafana_csv_version }} -o jsonpath='{.status.phase}' -n "{{ _namespace }}"
  register: grafanacsv
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: grafanacsv.stdout == "Succeeded"
 
- name: Create Grafana
  k8s:
    state: present
    namespace: "{{ _namespace }}"
    definition: "{{ lookup('file', role_path ~ '/files/grafana/instance.yml' ) | from_yaml }}"
 
- name: Wait until Grafana is phase 3
  command: >
    oc get grafana/grafana -o jsonpath='{.status.phase}' -n "{{ _namespace }}"
  register: grafana
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: grafana.stdout == "3"
 
- name: Check Grafana is running
  command: >
    oc rollout status Deployment/grafana-deployment --watch=true -n "{{ _namespace }}"
 
- name: Get Grafana route host
  command: >
    oc get route/grafana-route -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: grafana_route
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: grafana_route.stdout != ""
 
- name: Wait for Grafana route to respond with 200
  uri:
    url: "https://{{ grafana_route.stdout }}"
    method: GET
    validate_certs: false
    follow_redirects: yes
  register: grafanaresult
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: grafanaresult.status == 200
 
- name: todo
  debug:
    msg: "TODO: Create a dashboard for whatever we need to show"