-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathsetup.yml
145 lines (137 loc) · 5.26 KB
/
setup.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Copyright 2021 The Vitess Authors.
# 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,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: Setup all the hosts
hosts:
- all
roles:
- host
- cloudalchemy.node_exporter
- name: Setup Vitess deps
hosts:
- all
tasks:
- name: Install Golang
include_role:
name: vitess_build
tasks_from: golang
- name: Install MySQL
include_role:
name: vitess_build
tasks_from: mysql
- name: Install mysqld_exporter
include_role:
name: vitess_build
tasks_from: mysqld_exporter
- name: Setup etcd
hosts:
- all
roles:
- role: etcd
vars:
- etcd_launch: False
- name: Setup sysbench
hosts:
- all
roles:
- role: sysbench
- name: Setup prometheus
hosts: all
become: yes
become_user: root
tags:
- prometheus
roles:
- { role: cloudalchemy.prometheus, when: stats_remote_db_host is defined }
vars:
vitess_cluster: 'main'
mysqld_targets: "{% set targets = [] -%}{% for host in groups['vttablet'] -%}{% for tablet in hostvars[host]['tablets'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':'+ (tablet.mysqld_exporter_port | default(9104) |string )) }}{% endfor -%}{% endfor -%}{{ targets }}"
tablet_targets: "{% set targets = [] -%}{% for host in groups['vttablet'] -%}{% for tablet in hostvars[host]['tablets'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':'+ (tablet.port | default(16001) | string )) }}{% endfor -%}{% endfor -%}{{ targets }}"
gateway_targets: "{% set targets = [] -%}{% for host in groups['vtgate'] -%}{% for gateway in hostvars[host]['gateways'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':'+ (gateway.port | default(15001) | string )) }}{% endfor -%}{% endfor -%}{{ targets }}"
vtctld_targets: "{% set targets = [] -%}{% for host in groups['vtctld'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':'+ (vtctld_port | default(15000) | string )) }}{% endfor -%}{{ targets }}"
node_targets: "{% set targets= [] -%}{% for host in groups['all'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':9100' ) }}{% endfor -%}{{ targets }}"
prometheus_skip_install: false
prometheus_version: 2.49.1
prometheus_global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
prometheus_targets:
tablets:
- targets: '{{ tablet_targets }}'
labels:
component: vttablet
app: vitess
cluster: '{{ vitess_cluster }}'
region: '{{ cell }}'
keyspace: '{{ keyspace }}'
exec_uuid: "exec_uuid"
mysqld:
- targets: '{{ mysqld_targets }}'
labels:
component: mysqld
app: vitess
cluster: '{{ vitess_cluster }}'
region: '{{ cell }}'
keyspace: '{{ keyspace }}'
exec_uuid: "exec_uuid"
gateways:
- targets: '{{ gateway_targets }}'
labels:
component: vtgate
app: vitess
cluster: '{{ vitess_cluster }}'
region: '{{ cell }}'
exec_uuid: "exec_uuid"
vtctld:
- targets: '{{ vtctld_targets }}'
labels:
component: vtctld
app: vitess
cluster: '{{ vitess_cluster }}'
region: '{{ cell }}'
exec_uuid: "exec_uuid"
nodes:
- targets: '{{ node_targets }}'
labels:
component: node
app: vitess
cluster: '{{ vitess_cluster }}'
exec_uuid: "exec_uuid"
prometheus_scrape_configs:
- job_name: "node"
file_sd_configs:
- files:
- "{{ prometheus_config_dir }}/file_sd/nodes.yml"
- job_name: "vitess-vttablet"
file_sd_configs:
- files:
- "{{ prometheus_config_dir }}/file_sd/tablets.yml"
- job_name: "mysql"
file_sd_configs:
- files:
- "{{ prometheus_config_dir }}/file_sd/mysqld.yml"
- job_name: "vitess-vtctld"
file_sd_configs:
- files:
- "{{ prometheus_config_dir }}/file_sd/vtctld.yml"
- job_name: "vitess-vtgate"
file_sd_configs:
- files:
- "{{ prometheus_config_dir }}/file_sd/gateways.yml"
prometheus_remote_write:
- url: "http://{{ stats_remote_db_host }}/prom/api/v1/write"
basic_auth:
username: "{{ stats_remote_db_user }}"
password: "{{ stats_remote_db_password }}"
- url: "http://{{ stats_remote_db_host }}:{{ stats_remote_db_port }}/api/v1/prom/write?db={{ stats_remote_db_database }}&u={{ stats_remote_db_user }}&p={{ stats_remote_db_password }}"
prometheus_external_labels:
exec_uuid: "exec_uuid"