This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 275
/
collect_diagnosis.yml
93 lines (79 loc) · 2.21 KB
/
collect_diagnosis.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
---
# 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.
- hosts: localhost
tags:
- always
tasks:
- name: clean up fetch_tmp_dir
file: path={{ fetch_tmp_dir }} state=absent
- name: create fetch directories
file: path={{ item }} state=directory mode=0755
with_items:
- "{{ fetch_tmp_dir }}"
- "{{ fetch_dir }}"
- name: collect pd diagnosis information
hosts: pd_servers
tags:
- pd
roles:
- collector_pd
- name: collect tikv diagnosis information
hosts: tikv_servers
tags:
- tikv
roles:
- collector_tikv
- name: collect tidb diagnosis information
hosts: tidb_servers
tags:
- tidb
roles:
- collector_tidb
- name: collect pump diagnosis information
hosts: pump_servers
tags:
- pump
roles:
- collector_pump
- name: collect prometheus metric data
hosts: monitoring_servers
tags:
- prometheus
roles:
- collector_prometheus
- name: collect host infomation
hosts: monitored_servers
roles:
- collector_host
tags:
- host
- hosts: localhost
tags:
- always
tasks:
- name: collect inventory.ini
shell: "cd {{ fetch_tmp_dir }} && cp {{ playbook_dir }}/inventory.ini ."
- name: get datetime
shell: date +%Y%m%d_%H%M%S
register: datetime
changed_when: false
- set_fact:
archive_name: "collect_diagnosis_{{ datetime.stdout | trim }}.tar.gz"
- name: archive all diagnosis files
shell: "cd {{ playbook_dir }} && tar czvf {{ fetch_dir }}/{{ archive_name }} {{ fetch_tmp_dir | basename }}"
- name: clean up fetch_tmp_dir
file: path={{ fetch_tmp_dir }} state=absent
- name: display the file path of collect_diagnosis tarball
debug:
msg: "collect_diagnosis tarball: {{ fetch_dir }}/{{ archive_name }}"