-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.yml
121 lines (104 loc) · 4.5 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
---
## General
# Percona XtraDB Cluster documentation https://www.percona.com/doc/percona-xtradb-cluster/LATEST/index.html
# Version
percona_xtradb_version: "8.0"
# Package URL
percona_xtradb_deb_package: "percona-release_latest.generic_all.deb"
percona_xtradb_deb_repo: "https://repo.percona.com/apt/{{ percona_xtradb_deb_package }}"
# Package paths
percona_xtradb_download_path: /usr/src
percona_xtradb_package_path: "{{ percona_xtradb_download_path }}/{{ percona_xtradb_deb_package }}"
# Set true to force the download and installation
percona_xtradb_force_reinstall: false
# Installation
percona_xtradb_required_libs:
- python-mysqldb
- python3-mysqldb
percona_xtradb_packages:
- percona-xtradb-cluster-full
percona_xtradb_exec_name: mysql
# Configuration
percona_xtradb_global_config_file: /etc/mysql/my.cnf
percona_xtradb_config_file_name: mysqld.cnf
percona_mysql_pid_file: /var/run/mysqld/mysqld.pid
percona_mysql_datadir: /var/lib/mysql
# Current state: started, stopped
percona_xtradb_service_state: started
percona_xtradb_service: mysql
# Users
percona_mysql_user: mysql
percona_mysql_group: mysql
percona_mysql_root_user: root
percona_mysql_root_password: default
percona_mysql_users: []
# - name: example
# host: 127.0.0.1
# password: secret
# priv: [ '*.*:USAGE' ]
# Databases.
percona_mysql_databases: []
# - name: example
# collation: utf8_general_ci
# encoding: utf8
# Allowing playbooks to provide external option files
percona_mysql_extra_conf_include_dir: /etc/mysql/conf.d
percona_mysql_extra_conf_template_playbook_path: "{{ playbook_dir }}/templates/mysql/conf"
# Cluster
# Define Ansible group in which the nodes exist to be part of the cluster
percona_xtradb_nodes_group: ""
# Define the node pool
percona_xtradb_wsrep_cluster_address: "gcomm://{{ groups[percona_xtradb_nodes_group] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) | join(',') }}"
# Defines the which node should be considered the master in the cluster
# Used to bootstrap cluster
percona_xtradb_master_node: "{{ hostvars[ groups[percona_xtradb_nodes_group][0] ].ansible_default_ipv4.address }}"
# Defines the network address used
percona_xtradb_bind_address: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
# Secure traffic configuration
percona_xtradb_secure_cluster_traffic: false
percona_xtradb_secure_conf_dir: /etc/ssl/pxccerts
percona_xtradb_secure_cluster_conf_playbook_path: "{{ playbook_dir }}/files/ssl/certs"
# Options file groups with options to define System variables
# check https://dev.mysql.com/doc/refman/8.0/en/option-files.html
#
# To show available configuration variables
# https://www.percona.com/doc/percona-xtradb-cluster/LATEST/configure.html#configure
percona_xtradb_global_variables:
include_dirs:
- "{{ percona_mysql_extra_conf_include_dir }}"
groups:
client:
socket: /var/run/mysqld/mysqld.sock
# traffic encryption configuration
# ssl-ca: "{{ percona_xtradb_secure_conf_dir }}/ca.pem"
# ssl-cert: "{{ percona_xtradb_secure_conf_dir }}/client-cert.pem"
# ssl-key: "{{ percona_xtradb_secure_conf_dir }}/client-key.pem"
mysqld:
server-id: 1
datadir: "{{ percona_mysql_datadir }}"
socket: /var/run/mysqld/mysqld.sock
log-error: /var/log/mysql/error.log
pid_file: "{{ percona_mysql_pid_file }}"
binlog_expire_logs_seconds: 604800
# wsrep configuration
wsrep_provider: /usr/lib/galera4/libgalera_smm.so
wsrep_cluster_address: "{{ percona_xtradb_wsrep_cluster_address }}"
binlog_format: ROW
wsrep_slave_threads: 8
wsrep_log_conflicts:
innodb_autoinc_lock_mode: 2
wsrep_node_address: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
wsrep_cluster_name: pxc-cluster
wsrep_node_name: "{{ ansible_hostname }}"
pxc_strict_mode: ENFORCING
wsrep_sst_method: xtrabackup-v2
# traffic encryption configuration
# You can enable this configuration following this steps:
# 1. Setting pxc-encrypt-cluster-traffic to "ON"
# 2. Setting percona_xtradb_secure_cluster_traffic to "true"
# 3. Adding keys and certificates described in the documentation
# https://www.percona.com/doc/percona-xtradb-cluster/LATEST/security/encrypt-traffic.html#encrypting-pxc-traffic
pxc-encrypt-cluster-traffic: "OFF"
# ssl-ca: "{{ percona_xtradb_secure_conf_dir }}/ca.pem"
# ssl-cert: "{{ percona_xtradb_secure_conf_dir }}/server-cert.pem"
# ssl-key: "{{ percona_xtradb_secure_conf_dir }}/server-key.pem"