Set up a percona-server server in Debian-like systems.
python-mysqldb(2|3)
(will be installed)tee
(will not be installed)
-
percona_server_version
: [default:5.6
]: Version to install (e.g.5.6
) -
percona_server_root_password
: [default:+eswuw9uthUteFreyAqu
]: Root password Make sure to change! -
percona_server_install
: [['xtrabackup']
]: Additional packages to install -
percona_server_etc_my_cnf
: [default:[]
]: Global configuration declarations -
percona_server_etc_my_cnf_includedir
: [optional]: Used to include other option files from this directory (e.g./etc/mysql/conf.d/
) -
percona_server_user_root_cnf_manage
: [default:true
]: Whether or not to manage~root/.my.cnf
-
percona_server_user_root_cnf
: [default:percona_server_user_root_cnf_preset
, seedefaults/main.yml
]: Root user configuration declarations -
percona_server_use_legacy_auth_method
: [default:false
]: Use legacy authentication method (only Percona Server 8.0)
percona_server_ssl_map
: [default:{}
]: SSL declarationspercona_server_ssl_map.key
: [required]: The identifier of the file (e.g.ca-cert
)percona_server_ssl_map.key.src
: [required]: The local path of the file to copy, can be absolute or relative (e.g.../../../files/percona-server/etc/mysql/ca-cert.pem
)percona_server_ssl_map.key.dest
: [required]: The remote path of the file to copy (e.g./etc/mysql/ca-cert.pem
)percona_server_ssl_map.key.owner
: [optional, defaultroot
]: The name of the user that should own the filepercona_server_ssl_map.key.group
: [optional, defaultmysql
]:The name of the group that should own the filepercona_server_ssl_map.key.mode
: [optional, default0640
]: The mode of the file
-
percona_server_plugins_present
: [default:[]
]: Plugins toINSTALL
-
percona_server_plugins_present.{n}.name
: [required]: The name of the plugin (e.g.QUERY_RESPONSE_TIME_AUDIT
) -
percona_server_plugins_present.{n}.soname
: [required]: The base name of the shared library file that contains the code that implements the plugin (e.g.query_response_time.so
) -
percona_server_plugins_absent
: [default:[]
]: Plugins toUNINSTALL
-
percona_server_plugins_absent.{n}.name
: [required]: The name of the plugin
-
percona_server_databases_present
: [default:[]
]: Databases toCREATE
-
percona_server_databases_present.{n}.name
: [required]: The name of the database -
percona_server_databases_present.{n}.collation
: [optional, default:utf8_general_ci
]: The collation of the database -
percona_server_databases_present.{n}.encoding
: [optional, default:utf8
]: The character set of the database -
percona_server_databases_absent
: [default:[{name: test}]
]: Databases toDROP
-
percona_server_databases_absent.{n}.name
: [required]: The name of the database
-
percona_server_users_present
: [default:[]
]: Users toCREATE
-
percona_server_users_present.{n}.name
: [required]: The name of the user -
percona_server_users_present.{n}.password
: [required]: The password of the user -
percona_server_users_present.{n}.privs
: [required]: Privileges (e.g.'test.*:ALL'
) -
percona_server_users_present.{n}.hosts
: [optional, default:percona_server_users_present_hosts
]: Hosts toCREATE
privileges for (e.g.%
) -
percona_server_users_present_hosts
: [default:[localhost]
]: Hosts toCREATE
privileges for -
percona_server_users_absent
: [default:[{name: ''}]
]: Users toDROP
-
percona_server_users_absent.{n}.name
: [required]: The name of the user -
percona_server_users_absent.{n}.hosts
: [optional, default:percona_server_users_absent_hosts
]: Hosts toDROP
privileges for (e.g.%
) -
percona_server_users_absent_hosts
: [default:[{{ ansible_hostname }}, 127.0.0.1, localhost, ::1, %]
]: Hosts toDROP
privileges for
percona_server_queries
: [default:[]
]: Query declarationspercona_server_queries.{n}.database
: [required]: Name of the database to execute queries onpercona_server_queries.{n}.queries
: [default:[]
]: A list of queries to execute
percona_server_zoneinfo_manage
: [default:false
]: Whether or not to load time zone tablespercona_server_zoneinfo_tz_dir
: [default:/usr/share/zoneinfo
]: The zoneinfo directory path namepercona_server_zoneinfo_tz_file
: [default:''
]: The path of a single time zone file (e.g./usr/share/zoneinfo/Europe/Amsterdam
)percona_server_zoneinfo_tz_name
: [default:''
]: A time zone name (e.g.Europe/Amsterdam
)percona_server_zoneinfo_command
: [default:mysql_tzinfo_to_sql {{ percona_server_zoneinfo_tz_dir }}
]: The zoneinfo command to generate SQL (e.g.mysql_tzinfo_to_sql {{ percona_server_zoneinfo_tz_file }} {{ percona_server_zoneinfo_tz_name }}
,mysql_tzinfo_to_sql --leap {{ {{ percona_server_zoneinfo_tz_file }} }}
)
percona_server_toolkit_udfs_manage
: [default:true
]: Whether or not to install recommended hash functions (see)
None
percona-client
(see, whenpercona_server_manage_root_my_cnf
isfalse
)percona-server-tools
(see)percona-toolkit
(see)limits
(see)
---
- hosts: all
roles:
- percona-server
---
- hosts: all
roles:
- percona-server
vars:
percona_server_databases_present:
- name: ipsum
- name: dolor
percona_server_databases_absent:
- name: sit
- name: amet
percona_server_users_present_hosts:
- 'localhost'
- '%'
percona_server_users_present:
- name: consectetur
password: 'elit'
privs:
- 'ipsum.*:ALL'
- 'dolor.*:ALL'
- name: adipiscing
password: 'lacus'
privs:
- 'ipsum.*:SELECT'
- 'dolor.*:INSERT,UPDATE'
hosts:
- '%'
percona_server_users_absent:
- name: urna
- name: vehicula
hosts:
- '%'
- hosts: all
roles:
- percona-server
vars:
percona_server_ssl_map:
ca-cert:
src: ../../../files/percona-server/etc/mysql/ca-cert.pem
dest: /etc/mysql/ca-cert.pem
client-cert:
src: ../../../files/percona-server/etc/mysql/client-cert.pem
dest: /etc/mysql/client-cert.pem
client-key:
src: ../../../files/percona-server/etc/mysql/client-key.pem
dest: /etc/mysql/client-key.pem
server-cert:
src: ../../../files/percona-server/etc/mysql/server-cert.pem
dest: /etc/mysql/server-cert.pem
server-key:
src: ../../../files/percona-server/etc/mysql/server-key.pem
dest: /etc/mysql/server-key.pem
percona_server_etc_my_cnf:
- section: client
options:
- name: ssl_cert
value: "{{ percona_server_ssl_map['client-cert']['dest'] }}"
- name: ssl_key
value: "{{ percona_server_ssl_map['client-key']['dest'] }}"
- section: mysqld
options:
- name: ssl_ca
value: "{{ percona_server_ssl_map['ca-cert']['dest'] }}"
- name: ssl_cert
value: "{{ percona_server_ssl_map['server-cert']['dest'] }}"
- name: ssl_key
value: "{{ percona_server_ssl_map['server-key']['dest'] }}"
- hosts: master
roles:
- percona-server
vars:
percona_server_users_present:
- name: replicator
password: 'replicator'
privs:
- '*.*:REPLICATION SLAVE'
hosts:
- '%'
percona_server_etc_my_cnf:
- section: mysqld
options:
- name: server_id
value: 1
- name: log_bin
value: mysql-bin
- name: log_bin_index
value: mysql-bin.index
- name: sync_binlog
value: 1
- name: report_host
value: "{{ inventory_hostname }}"
- hosts: slave
roles:
- percona-server
vars:
- name: replicator
password: 'replicator'
privs:
- '*.*:REPLICATION SLAVE'
hosts:
- '%'
percona_server_etc_my_cnf:
- section: mysqld
options:
- name: server_id
value: 2
- name: relay_log
value: mysql-relay
- name: relay_log_index
value: mysql-relay.index
- name: sync_relay_log
value: 1
- name: report_host
value: "{{ inventory_hostname }}"
- name: read_only
value: 1
- name: skip_slave_start
value: 1
- hosts: master1
roles:
- percona-server
vars:
percona_server_users_present:
- name: replicator
password: 'replicator'
privs:
- '*.*:REPLICATION SLAVE'
hosts:
- '%'
percona_server_etc_my_cnf:
- section: mysqld
options:
- name: server_id
value: 1
- name: log_bin
value: mysql-bin
- name: log_bin_index
value: mysql-bin.index
- name: sync_binlog
value: 1
- name: relay_log
value: mysql-relay
- name: relay_log_index
value: mysql-relay.index
- name: sync_relay_log
value: 1
- name: report_host
value: "{{ inventory_hostname }}"
- name: skip_slave_start
value: 1
- hosts: master2
roles:
- percona-server
vars:
percona_server_users_present:
- name: replicator
password: 'replicator'
privs:
- '*.*:REPLICATION SLAVE'
hosts:
- '%'
percona_server_etc_my_cnf:
- section: mysqld
options:
- name: server_id
value: 2
- name: log_bin
value: mysql-bin
- name: log_bin_index
value: mysql-bin.index
- name: sync_binlog
value: 1
- name: relay_log
value: mysql-relay
- name: relay_log_index
value: mysql-relay.index
- name: sync_relay_log
value: 1
- name: report_host
value: "{{ inventory_hostname }}"
- name: skip_slave_start
value: 1
MIT
Mischa ter Smitten (based on work of overdrive3000, geerlingguy and silviud)
Are welcome!