-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.yml
313 lines (278 loc) · 10.3 KB
/
main.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
---
# Enable / disable ProxySQL as a service.
# Type: Bool
proxysql_service_enabled: True
# Restart ProxySQL if static variables are changing. For a list of static
# variables take a look at `proxysql_non_dynamic_variables` in `vars/main.yml`.
# Type: Bool
proxysql_restart_on_static_variables_change: True
# Repository
# If both, `proxysql_use_official_repo` and `proxysql_use_percona_repo` are set
# to `False` the module will automatically download the defined
# `proxysql_version` as a package from Github and install the same.
# Use the official ProxySQL repository.
# Type: Bool
proxysql_use_official_repo: True
# Use the Percona repository.
# Type: Bool
proxysql_use_percona_repo: False
# Define the repository version for the percona repository.
# Type: Str
proxysql_percona_release: latest
# The ProxySQL version which should be installed if not using the ProxySQL
# repository.
# Type: Int
proxysql_version: 1.4.15
# Configuration
# The path where ProxySQL should save it's database and logs.
# Type: Str
proxysql_datadir: /var/lib/proxysql
# Define the proxysql.cnf template
# Type: Str
proxysql_proxysql_cnf_template: proxysql.cnf.j2
# Define the proxysql-admin.cnf template
# Type: Str
proxysql_proxysql_admin_cnf_template: proxysql-admin.cnf.j2
# The login variables for the configuration of ProxySQL itself. They are just
# used inside the `main.yml` file and here to simplify the configuration.
# Type: Str
proxysql_login_admin_host: 127.0.0.1
proxysql_login_admin_password: admin
proxysql_login_admin_port: 6032
proxysql_login_admin_user: admin
# Global variables
# `admin_variables` in `proxysql_global_variables_kv`: contains global
# variables that control the functionality of the admin interface.
# `admin_variables` are prefixed with `admin-`.
# `mysql_variables`: in `proxysql_global_variables_kv` contains global
# variables that control the functionality for handling the incoming
# MySQL traffic.
# `mysql_variables` are prefixed with `mysql-`.
# The variables should be either a string or an integer. You should mark
# a boolean value as a string, e.g. "True" or "False".
# For a full reference take a look at:
# https://github.com/sysown/proxysql/wiki/Global-variables
# Format:
# Type: Dict
# proxysql_global_variables:
# load_to_runtime: "True"
# save_to_disk: "True"
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
proxysql_global_variables:
login_host: "{{ proxysql_login_admin_host }}"
login_password: "{{ proxysql_login_admin_password }}"
login_port: "{{ proxysql_login_admin_port }}"
login_user: "{{ proxysql_login_admin_user }}"
# Format:
# Type: Dict
# proxysql_global_variables_kv:
# key: value
# e.g.:
# proxysql_global_variables_kv:
# admin-admin_credentials: "{{ proxysql_login_admin_user }}:{{ proxysql_login_admin_password }}"
# admin-mysql_ifaces: "{{ proxysql_login_admin_host }}:{{ proxysql_login_admin_port }}"
# mysql-interfaces: 0.0.0.0:6033
# mysql-commands_stats: "True"
# mysql-threads: 4
proxysql_global_variables_kv: {}
# Backend servers
# `proxysql_backend_servers`: contains rows for the mysql_servers table from
# the admin interface. Basically, these define the backend servers towards
# which the incoming MySQL traffic is routed.
# For a full reference take a look at:
# https://docs.ansible.com/ansible/latest/modules/proxysql_backend_servers_module.html
# Important: This module uses `hostgroup` (which is the correct name in the
# database) instead of `hostgroup_id` (which is the default in the Ansible
# module)!
# Format:
# Type: Dict
# proxysql_backend_servers:
# mysql-srv1-hg1:
# comment: mysql-srv1-hg1
# hostgroup: 1
# hostname: 172.16.77.101
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# max_connections: 1000
# max_replication_lag: 0
# status: ONLINE
# weight: 1
# mysql-srv1-hg2:
# comment: mysql-srv1-hg2
# hostgroup: 2
# hostname: 172.16.77.101
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# max_connections: 1000
# max_replication_lag: 0
# status: ONLINE
# weight: 1
proxysql_backend_servers: {}
# ProxySQL servers
# `proxysql_proxysql_servers`: contains rows for the proxysql_servers table
# from the admin interface. Basically, these define the ProxySQL servers
# which are used for clustering.
# For a full reference take a look at:
# `library/proxysql_proxysql_servers.py` since this is not a part of the
# official Ansible package.
# Format:
# Type: Dict
# proxysql_proxysql_servers:
# proxysql-srv-1:
# comment: proxysql-srv-1
# hostname: 172.16.77.201
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# weight: 0
# proxysql-srv-2:
# comment: proxysql-srv-2
# hostname: 172.16.77.202
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# weight: 0
proxysql_proxysql_servers: {}
# Replication hostgroups
# `proxysql_replication_hostgroups`: represent a pair of writer_hostgroup
# and reader_hostgroup. ProxySQL will monitor the value of read_only for all
# the servers in specified hostgroups, and based on the value of read_only
# will assign the server to the writer or reader hostgroups.
# For a full reference take a look at:
# https://docs.ansible.com/ansible/latest/modules/proxysql_replication_hostgroups_module.html
# Format:
# Type: Dict
# proxysql_replication_hostgroups:
# Cluster:
# comment: Cluster
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# reader_hostgroup: 2
# writer_hostgroup: 1
proxysql_replication_hostgroups: {}
# Users
# `proxysql_mysql_users`: contains rows for the mysql_users table from the
# admin interface. Basically, these define the users which can connect to the
# proxy, and the users with which the proxy can connect to the backend servers.
# For a full reference take a look at:
# http://docs.ansible.com/ansible/latest/proxysql_mysql_users_module.html
# Format:
# Type: Dict
# proxysql_mysql_users:
# user1:
# active: 1
# backend: 1
# default_hostgroup: 1
# fast_forward: 0
# frontend: 1
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# max_connections: 10000
# password: Passw0rd
# transaction_persistent: 1
# username: user1
# user2:
# active: 1
# backend: 1
# default_hostgroup: 2
# fast_forward: 0
# frontend: 1
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# max_connections: 1000
# password: dr0wssaP
# transaction_persistent: 1
# username: user2
proxysql_mysql_users: {}
# Query rules
# `proxysql_query_rules` contains rows for the mysql_query_rules table from
# the admin interface. Basically, these define the rules used to classify and
# route the incoming MySQL traffic, according to various criteria (patterns
# matched, user used to run the query, etc.).
# For a full reference take a look at:
# http://docs.ansible.com/ansible/latest/proxysql_query_rules_module.html
# Format:
# Type: Dict
# proxysql_query_rules:
# catchall:
# active: 1
# apply: 1
# destination_hostgroup: 1
# flagIN: 0
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# match_pattern: .*@.*
# negate_match_pattern: 0
# rule_id: 1
# selectforupdate:
# active: 1
# apply: 1
# destination_hostgroup: 1
# flagIN: 0
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# match_pattern: ^SELECT.*FOR UPDATE
# negate_match_pattern: 0
# rule_id: 2
# select:
# active: 1
# apply: 0
# destination_hostgroup: 2
# flagIN: 0
# login_host: "{{ proxysql_login_admin_host }}"
# login_password: "{{ proxysql_login_admin_password }}"
# login_port: "{{ proxysql_login_admin_port }}"
# login_user: "{{ proxysql_login_admin_user }}"
# match_pattern: ^SELECT.*
# negate_match_pattern: 0
# rule_id: 3
proxysql_query_rules: {}
# Percona ProxySQL Admin
# The ProxySQL Admin (proxysql-admin) solution configures Percona
# XtraDB cluster nodes into ProxySQL.
# For a full reference take a look at:
# https://github.com/percona/proxysql-admin-tool
# Format:
# Type: Dict
# proxysql_percona_admin_tool:
# PROXYSQL_DATADIR: "{{ proxysql_datadir }}"
# PROXYSQL_USERNAME: "{{ proxysql_login_admin_user }}"
# PROXYSQL_PASSWORD: "{{ proxysql_login_admin_password }}"
# PROXYSQL_HOSTNAME: "{{ proxysql_login_admin_host }}"
# PROXYSQL_PORT: "{{ proxysql_login_admin_port }}"
# CLUSTER_USERNAME: admin
# CLUSTER_PASSWORD: admin
# CLUSTER_HOSTNAME: localhost
# CLUSTER_PORT: 3306
# MONITOR_USERNAME: monitor
# MONITOR_PASSWORD: monit0r
# CLUSTER_APP_USERNAME: proxysql_user
# CLUSTER_APP_PASSWORD: passw0rd
# WRITE_HOSTGROUP_ID: 10
# READ_HOSTGROUP_ID: 11
# MODE: singlewrite
proxysql_percona_admin_tool:
PROXYSQL_DATADIR: "{{ proxysql_datadir }}"
PROXYSQL_USERNAME: "{{ proxysql_login_admin_user }}"
PROXYSQL_PASSWORD: "{{ proxysql_login_admin_password }}"
PROXYSQL_HOSTNAME: "{{ proxysql_login_admin_host }}"
PROXYSQL_PORT: "{{ proxysql_login_admin_port }}"