Modular Ansible Role for deploying and configuring MySQL/MariaDB
This Ansible role supports server-focused Linux distributions that remain within their vendor support windows, and aims to follow their deprecation policies. The releases below are the ones verified by CI:
- AlmaLinux 9.x / RockyLinux 9.x
- Debian 12 (bookworm)
- Ubuntu 24.04 LTS (noble)
EOL releases (CentOS 7, EL8, Debian 10/11, Ubuntu 20.04/22.04) are no longer tested. MariaDB's last EL7 build of 10.11 was 10.11.9, which is archive-only and has received no updates since CentOS 7 reached EOL. Separately, ansible-core no longer supports the Python versions shipped by EL7 and EL8 as managed-node interpreters.
- community.mysql
Available variables are listed below with their default values (you can also see defaults/main.yml)
| Variable | Description |
|---|---|
| mysql_config_file | Default: /etc/my.cnf |
| mysql_config_include_dir | Default: /etc/my.cnf.d |
| mysql_daemon | Default: mariadb |
| mysql_innodb_buffer_pool_size | Default: 128M |
| mysql_innodb_file_per_table | Default: 1 |
| mysql_innodb_log_buffer_size | Default: 16M |
| mysql_innodb_log_file_size | Default: 96M |
| mysql_log_dir | Default: /var/log/ |
| mysql_log_error | Default: "{{ mysql_log_dir }}/mariadb/mariadb.log" |
| mysql_log_file_group | Default: mysql |
| mysql_log_warning | Default: 1 |
| mysql_packages | Default: The MySQL packages to install |
| mysql_query_alloc_block_size | Default: 16384 |
| mysql_query_cache_limit | Default: 1M |
| mysql_query_cache_min_res_unit | Default: 4096 |
| mysql_query_cache_size | Default: 16M |
| mysql_query_cache_strip_comments | Default: 0 |
| mysql_query_cache_type | Default: 1 |
| mysql_query_cache_wlock_invalidate | Default: 0 |
| mysql_query_prealloc_size | Default: 24576 |
| mysql_root_home | Default: /root |
| mysql_root_password_update | Default: false |
| mysql_root_username | Default: root |
| mysql_slow_query_log_enabled | Default: true |
| mysql_slow_query_log_file | Default: "{{ mysql_log_dir }}/mysql-slow.log" |
| mysql_socket | Default: true |
| mysql_socket_path | Default: /var/lib/mysql/mysql.sock |
| mysql_supports_innodb_large_prefix | Default: true |
| mysql_syslog_tag | Default: mariadb |
| password_generate | Default: "{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}" |
- hosts: www
roles:
- role: inmotionhosting.mysqlGPLv3
