Skip to content

Commit e24cee2

Browse files
committed
Add playbooks to regenerate secrets for openshift-monitoring
1 parent 8a57696 commit e24cee2

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
- name: Update monitoring certificates
3+
hosts: oo_first_master
4+
vars:
5+
roles:
6+
- lib_openshift
7+
- openshift_facts
8+
tasks:
9+
- name: Remove TLS secret
10+
oc_obj:
11+
name: "{{ item }}"
12+
kind: secret
13+
state: absent
14+
namespace: openshift-monitoring
15+
with_items:
16+
- alertmanager-main-tls
17+
- grafana-tls
18+
- kube-state-metrics-tls
19+
- node-exporter-tls
20+
- prometheus-k8s-tls
21+
22+
- name: Remove Prometheus pods
23+
oc_obj:
24+
selector: "app=prometheus"
25+
kind: pod
26+
state: absent
27+
namespace: openshift-monitoring
28+
29+
- name: Verify that the Prometheus is running
30+
oc_obj:
31+
namespace: openshift-monitoring
32+
kind: statefulset
33+
state: list
34+
name: prometheus-k8s
35+
register: prometheus_ss
36+
until:
37+
- prometheus_ss.results.results[0].status.readyReplicas is defined
38+
- prometheus_ss.results.results[0].status.readyReplicas > 0
39+
retries: 60
40+
delay: 10
41+
changed_when: false
42+
43+
- name: Remove Alertmanager pods
44+
oc_obj:
45+
selector: "app=alertmanager"
46+
kind: pod
47+
state: absent
48+
namespace: openshift-monitoring
49+
50+
- name: Verify that the Alertmanager is running
51+
oc_obj:
52+
namespace: openshift-monitoring
53+
kind: statefulset
54+
state: list
55+
name: alertmanager-main
56+
register: alertmanager_ss
57+
until:
58+
- alertmanager_ss.results.results[0].status.readyReplicas is defined
59+
- alertmanager_ss.results.results[0].status.readyReplicas > 0
60+
retries: 60
61+
delay: 10
62+
changed_when: false
63+
64+
- name: Remove kube-state-metrics pods
65+
oc_obj:
66+
selector: "app=kube-state-metrics"
67+
kind: pod
68+
state: absent
69+
namespace: openshift-monitoring
70+
71+
- name: Verify that the Kube State Metrics is running
72+
oc_obj:
73+
namespace: openshift-monitoring
74+
kind: deployment
75+
state: list
76+
name: kube-state-metrics
77+
register: kube_state_metrics_deployment
78+
until:
79+
- kube_state_metrics_deployment.results.results[0].status.readyReplicas is defined
80+
- kube_state_metrics_deployment.results.results[0].status.readyReplicas > 0
81+
retries: 60
82+
delay: 10
83+
changed_when: false
84+
85+
- name: Remove grafana pods
86+
oc_obj:
87+
selector: "app=grafana"
88+
kind: pod
89+
state: absent
90+
namespace: openshift-monitoring
91+
92+
- name: Verify that the Grafana is running
93+
oc_obj:
94+
namespace: openshift-monitoring
95+
kind: deployment
96+
state: list
97+
name: grafana
98+
register: grafana_deployment
99+
until:
100+
- grafana_deployment.results.results[0].status.readyReplicas is defined
101+
- grafana_deployment.results.results[0].status.readyReplicas > 0
102+
retries: 60
103+
delay: 10
104+
changed_when: false
105+
106+
- name: Remove node-exporter pods
107+
oc_obj:
108+
selector: "app=node-exporter"
109+
kind: pod
110+
state: absent
111+
namespace: openshift-monitoring
112+
113+
- name: Verify that the node-exporter is running
114+
oc_obj:
115+
namespace: openshift-monitoring
116+
kind: daemonset
117+
state: list
118+
name: node-exporter
119+
register: node_exporter_ds
120+
until:
121+
- node_exporter_ds.results.results[0].status.numberReady is defined
122+
- node_exporter_ds.results.results[0].status.numberReady > 0
123+
retries: 60
124+
delay: 10
125+
changed_when: false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- import_playbook: ../init/main.yml
3+
4+
- import_playbook: private/redeploy-certificates.yml

playbooks/redeploy-certificates.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@
3030

3131
- import_playbook: openshift-console/private/redeploy-certificates.yml
3232
when: openshift_console_install | default(true) | bool
33+
34+
- import_playbook: openshift-monitoring/private/redeploy-certificates.yml
35+
when: openshift_cluster_monitoring_operator_install | default(true) | bool

0 commit comments

Comments
 (0)