forked from pingcap/tidb-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unsafe_cleanup.yml
122 lines (106 loc) · 3.57 KB
/
unsafe_cleanup.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
# Copyright 2016 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.
# The playbook of TiDB
- import_playbook: stop.yml
- import_playbook: unsafe_cleanup_container.yml
when: deployment_method == 'docker'
- hosts: monitored_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- node_exporter-{{ node_exporter_port }}.service
- blackbox_exporter-{{ blackbox_exporter_port }}.service
- hosts: alertmanager_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- alertmanager-{{ alertmanager_port }}.service
- hosts: monitoring_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- pushgateway-{{ pushgateway_port }}.service
- prometheus-{{ prometheus_port }}.service
- hosts: kafka_exporter_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- kafka_exporter-{{ kafka_exporter_port }}.service
- hosts: tidb_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- tidb-{{ tidb_port }}.service
- hosts: pump_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when:
- enable_binlog|default(false)
- process_supervision == 'systemd'
with_items:
- pump-{{ pump_port }}.service
- hosts: tikv_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- tikv-{{ tikv_port }}.service
- name: cleaning up wal dir
file: path={{ wal_dir }} state=absent
when: "wal_dir is defined"
- name: cleaning up raftdb dir
file: path={{ raftdb_path }} state=absent
when: "raftdb_path is defined"
- hosts: pd_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- pd-{{ pd_client_port }}.service
- hosts: grafana_servers
tasks:
- name: clean systemd config
file: path="/etc/systemd/system/{{ item }}" state=absent
become: true
when: process_supervision == 'systemd'
with_items:
- grafana-{{ grafana_port }}.service
- grafana_collector-{{ grafana_collector_port }}.service
- hosts: all
tasks:
- name: using rm command to clean up deploy_dir
shell: "rm -rf {{ deploy_dir }}/*"
- name: cleaning up deploy dir
file: path={{ deploy_dir }} state=absent