Installs MySQL Distr/MySQL Community/Percona/MariaDB plus management of configuration/databases/etc.
Param | Default | Description |
---|---|---|
mysql_setup |
full |
Setup mode. See OSSHelp KB article |
root_password |
- |
MySQL root password. When defined .my.cnf will be genetated |
params |
[] |
MySQL common params |
conf_available_params |
[] |
MySQL conf-avalaible params |
databases |
[] |
List of databases you want to create |
users |
[] |
List of users you want to create |
mysql_no_restart |
true |
Param for enabling MySQL restart (disabled by default) |
initial_setup |
false |
When true initial-setup will be created (fixes for succesfully starting MySQL) |
- role: mysql
- role: mysql
version: required-version-here
Valid values for required-version-here
:
- default (version from current distribution)
- percona_5.5
- percona_5.6
- percona_5.7
- percona_8.0
- maria_10.3
- maria_10.4
- maria_10.5 (bionic and focal only)
- maria_10.6 (bionic only)
- maria_10.7 (bionic only)
- maria_10.8 (bionic only)
- community_5.7 (xenial and bionic only)
- community_8.0
- community_latest (installs latest available version)
- role: mysql
params:
- { key: bind_address, value: 0.0.0.0 }
- { key: innodb_file_per_table, value: 'on' }
conf_available_params:
prod:
- { key: innodb_buffer_pool_size, value: '10G' }
- { key: innodb_buffer_pool_instances, value: '10' }
dev:
- { key: innodb_buffer_pool_size, value: '256M' }
- { key: innodb_buffer_pool_instances, value: '1' }
For more information see knowledge base article.
- role: mysql
databases:
- name: ansible
users:
- name: ansible
password: "{{ password_from_vault }}"
If you see youshouldchangethepassword123!
password in /root/.my.cnf
, then your value for initial_setup
is true
, or you are using a MySQL base image. To set a password, define it in the lxhelper.yml in the profile section. See example below:
profiles:
default:
mysql:
root-password: {{mysql_root_password}}
root-host: '%'
The parameters for MySQL are applied after service restart, to enable service restart use the parameter mysql_no_restart
.
- split role
- tests
- percona 8, percona cluster
- increase sanity of root password changing mechanism (see initial-setup script)
- installing root password mechanism is not working properly with percona_5.5 as version, needs to be tested and fixed
- remove workaround for percona 8.0 installation (pre_install_command). See documentation
- Idempotence test fails for "mysql : create users" on MySQL v8.x.x (community and percona)
- check and fix logic in initial-setup.j2. useless
test -r "${my_cnf}" && {
- check and fix systemd-override.j2 "ExecStartPre=" workaround. Add script from default ExecStartPre to initial-setup.j2
- check and fix mysql_set_root_password_command for all releases
- deal with periodical 404 errors on percona-server packages downloads from repo.percona.com