diff --git a/mysql/README.md b/mysql/README.md index f39c6f84..4c813a15 100644 --- a/mysql/README.md +++ b/mysql/README.md @@ -20,16 +20,16 @@ Tasks are extracted in several files, included in `tasks/main.yml` : * `mysql_variant` : install Oracle's MySQL or MariaDB (default: `oracle`) [Debian 8 only]; * `mysql_replace_root_with_mysqladmin`: switch from `root` to `mysqladmin` user or not ; -* `mysql_bind_address` : (default: `127.0.0.1`) ; * `mysql_thread_cache_size`: number of threads for the cache ; * `mysql_innodb_buffer_pool_size`: amount of RAM dedicated to InnoDB ; -* `mysql_max_connections`: maximum number of simultaneous connections (default: `250`) ; -* `mysql_max_connect_errors`: number of permitted successive interrupted connection requests before a host gets blocked (default: `10`) ; -* `mysql_table_cache`: (default: `64`) ; -* `mysql_tmp_table_size`: (default: `128M`) ; -* `mysql_max_heap_table_size`: (default: `128M`) ; -* `mysql_query_cache_limit`: (default: `8M`) ; -* `mysql_query_cache_size`: (default: `256M`) ; +* `mysql_bind_address` : (default: `Null`, default evolinux config is then used) ; +* `mysql_max_connections`: maximum number of simultaneous connections (default: `Null`, default evolinux config is then used) ; +* `mysql_max_connect_errors`: number of permitted successive interrupted connection requests before a host gets blocked (default: `Null`, default evolinux config is then used) ; +* `mysql_table_cache`: (default: `Null`, default evolinux config is then used) ; +* `mysql_tmp_table_size`: (default: `Null`, default evolinux config is then used) ; +* `mysql_max_heap_table_size`: (default: `Null`, default evolinux config is then used) ; +* `mysql_query_cache_limit`: (default: `Null`, default evolinux config is then used) ; +* `mysql_query_cache_size`: (default: `Null`, default evolinux config is then used) ; * `mysql_custom_datadir`: custom datadir. * `mysql_custom_tmpdir`: custom tmpdir. * `general_alert_email`: email address to send various alert messages (default: `root@localhost`). diff --git a/mysql/defaults/main.yml b/mysql/defaults/main.yml index 1b83fc86..d93f7270 100644 --- a/mysql/defaults/main.yml +++ b/mysql/defaults/main.yml @@ -14,16 +14,20 @@ mysql_replace_root_with_mysqladmin: True mysql_custom_datadir: '' mysql_custom_tmpdir: '' -mysql_bind_address: '127.0.0.1' mysql_thread_cache_size: '{{ ansible_processor_cores }}' mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M' -mysql_max_connections: '250' -mysql_max_connect_errors: '10' -mysql_table_cache: '64' -mysql_tmp_table_size: '128M' -mysql_max_heap_table_size: '128M' -mysql_query_cache_limit: '8M' -mysql_query_cache_size: '256M' + +# If these variables are changed to non-Null values, +# they will be added in the zzz-evolinux-custom.cnf file. +# Otherwise, the value from de the z-evolinux-defaults.cnf file will preveil. +mysql_bind_address: Null +mysql_max_connections: Null +mysql_max_connect_errors: Null +mysql_table_cache: Null +mysql_tmp_table_size: Null +mysql_max_heap_table_size: Null +mysql_query_cache_limit: Null +mysql_query_cache_size: Null mysql_cron_optimize: True diff --git a/mysql/templates/evolinux-custom.cnf.j2 b/mysql/templates/evolinux-custom.cnf.j2 index 0fff23b9..796a1429 100644 --- a/mysql/templates/evolinux-custom.cnf.j2 +++ b/mysql/templates/evolinux-custom.cnf.j2 @@ -1,12 +1,31 @@ [mysqld] +{% if mysql_bind_address %} bind-address = {{ mysql_bind_address }} +{% endif %} +{% if mysql_thread_cache_size %} thread_cache_size = {{ mysql_thread_cache_size }} +{% endif %} +{% if mysql_innodb_buffer_pool_size %} innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }} +{% endif %} +{% if mysql_max_connections %} max_connections = {{ mysql_max_connections }} +{% endif %} +{% if mysql_max_connect_errors %} max_connect_errors = {{ mysql_max_connect_errors }} +{% endif %} +{% if mysql_table_cache %} table_cache = {{ mysql_table_cache }} +{% endif %} +{% if mysql_tmp_table_size %} tmp_table_size = {{ mysql_tmp_table_size }} +{% endif %} +{% if mysql_max_heap_table_size %} max_heap_table_size = {{ mysql_max_heap_table_size }} +{% endif %} +{% if mysql_query_cache_limit %} query_cache_limit = {{ mysql_query_cache_limit }} +{% endif %} +{% if mysql_query_cache_limit %} query_cache_size = {{ mysql_query_cache_size }} - +{% endif %}