mysql: default values should stay in the proper file

Default values are set in z-evolinux-defaults.cnf and should be added in 
zzz-evolinux-custom.cnf only if the value differs from the default.
This commit is contained in:
Jérémy Lecour 2018-08-23 12:17:13 +02:00 committed by Jérémy Lecour
parent 12c49ed93b
commit d09fd169b3
3 changed files with 40 additions and 17 deletions

View file

@ -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_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_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_thread_cache_size`: number of threads for the cache ;
* `mysql_innodb_buffer_pool_size`: amount of RAM dedicated to InnoDB ; * `mysql_innodb_buffer_pool_size`: amount of RAM dedicated to InnoDB ;
* `mysql_max_connections`: maximum number of simultaneous connections (default: `250`) ; * `mysql_bind_address` : (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: `10`) ; * `mysql_max_connections`: maximum number of simultaneous connections (default: `Null`, default evolinux config is then used) ;
* `mysql_table_cache`: (default: `64`) ; * `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_tmp_table_size`: (default: `128M`) ; * `mysql_table_cache`: (default: `Null`, default evolinux config is then used) ;
* `mysql_max_heap_table_size`: (default: `128M`) ; * `mysql_tmp_table_size`: (default: `Null`, default evolinux config is then used) ;
* `mysql_query_cache_limit`: (default: `8M`) ; * `mysql_max_heap_table_size`: (default: `Null`, default evolinux config is then used) ;
* `mysql_query_cache_size`: (default: `256M`) ; * `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_datadir`: custom datadir.
* `mysql_custom_tmpdir`: custom tmpdir. * `mysql_custom_tmpdir`: custom tmpdir.
* `general_alert_email`: email address to send various alert messages (default: `root@localhost`). * `general_alert_email`: email address to send various alert messages (default: `root@localhost`).

View file

@ -14,16 +14,20 @@ mysql_replace_root_with_mysqladmin: True
mysql_custom_datadir: '' mysql_custom_datadir: ''
mysql_custom_tmpdir: '' mysql_custom_tmpdir: ''
mysql_bind_address: '127.0.0.1'
mysql_thread_cache_size: '{{ ansible_processor_cores }}' mysql_thread_cache_size: '{{ ansible_processor_cores }}'
mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M' mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M'
mysql_max_connections: '250'
mysql_max_connect_errors: '10' # If these variables are changed to non-Null values,
mysql_table_cache: '64' # they will be added in the zzz-evolinux-custom.cnf file.
mysql_tmp_table_size: '128M' # Otherwise, the value from de the z-evolinux-defaults.cnf file will preveil.
mysql_max_heap_table_size: '128M' mysql_bind_address: Null
mysql_query_cache_limit: '8M' mysql_max_connections: Null
mysql_query_cache_size: '256M' 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 mysql_cron_optimize: True

View file

@ -1,12 +1,31 @@
[mysqld] [mysqld]
{% if mysql_bind_address %}
bind-address = {{ mysql_bind_address }} bind-address = {{ mysql_bind_address }}
{% endif %}
{% if mysql_thread_cache_size %}
thread_cache_size = {{ 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 }} innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }}
{% endif %}
{% if mysql_max_connections %}
max_connections = {{ mysql_max_connections }} max_connections = {{ mysql_max_connections }}
{% endif %}
{% if mysql_max_connect_errors %}
max_connect_errors = {{ mysql_max_connect_errors }} max_connect_errors = {{ mysql_max_connect_errors }}
{% endif %}
{% if mysql_table_cache %}
table_cache = {{ mysql_table_cache }} table_cache = {{ mysql_table_cache }}
{% endif %}
{% if mysql_tmp_table_size %}
tmp_table_size = {{ 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 }} max_heap_table_size = {{ mysql_max_heap_table_size }}
{% endif %}
{% if mysql_query_cache_limit %}
query_cache_limit = {{ mysql_query_cache_limit }} query_cache_limit = {{ mysql_query_cache_limit }}
{% endif %}
{% if mysql_query_cache_limit %}
query_cache_size = {{ mysql_query_cache_size }} query_cache_size = {{ mysql_query_cache_size }}
{% endif %}