ansible-mysql/templates/etc/mysql/my.cnf.j2

88 lines
2.6 KiB
Plaintext
Raw Normal View History

2015-08-11 04:45:01 +07:00
#
# {{ ansible_managed }}
#
[client]
port = {{ mysql_port }}
socket = {{ mysql_socket }}
[mysqld]
port = {{ mysql_port }}
bind-address = {{ mysql_bind_address }}
datadir = {{ mysql_datadir }}
socket = {{ mysql_socket }}
2017-06-29 02:51:03 +07:00
{# TODO: FIX later #}
2015-08-11 04:45:01 +07:00
# Logging configuration.
{% if mysql_log_error == 'syslog' or mysql_log == 'syslog' %}
syslog
syslog-tag = {{ mysql_syslog_tag }}
{% else %}
{% if mysql_log %}
log = {{ mysql_log }}
{% endif %}
log-error = {{ mysql_log_error }}
{% endif %}
2015-08-11 04:45:01 +07:00
{% if mysql_slow_query_log_enabled %}
# Slow query log configuration.
{% if mysql_vendor not in ['mariadb', 'mariadbgalera'] or mysql_mariadb_version | version_compare('10.0', '<') %}
2015-08-11 04:45:01 +07:00
log_slow_queries = 1
{% endif %}
2015-08-11 04:45:01 +07:00
slow_query_log = 1
slow_query_log_file = {{ mysql_slow_query_log_file }}
long_query_time = {{ mysql_slow_query_time }}
{% endif %}
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
# User is ignored when systemd is used (fedora >= 15).
user = mysql
# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema
# Memory settings.
key_buffer_size = {{ mysql_key_buffer_size }}
max_allowed_packet = {{ mysql_max_allowed_packet }}
table_open_cache = {{ mysql_table_open_cache }}
sort_buffer_size = {{ mysql_sort_buffer_size }}
read_buffer_size = {{ mysql_read_buffer_size }}
read_rnd_buffer_size = {{ mysql_read_rnd_buffer_size }}
myisam_sort_buffer_size = {{ mysql_myisam_sort_buffer_size }}
thread_cache_size = {{ mysql_thread_cache_size }}
query_cache_size = {{ mysql_query_cache_size }}
# Other settings.
wait_timeout = {{ mysql_wait_timeout }}
# Try number of CPU's * 2 for thread_concurrency.
thread_concurrency = {{ mysql_thread_concurrency }}
# InnoDB settings.
innodb_file_per_table = {{ mysql_innodb_file_per_table }}
innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }}
innodb_log_buffer_size = {{ mysql_innodb_log_buffer_size }}
2015-08-11 04:45:01 +07:00
innodb_flush_log_at_trx_commit = {{ mysql_innodb_flush_log_at_trx_commit }}
innodb_lock_wait_timeout = {{ mysql_innodb_lock_wait_timeout }}
{# If this setting changes on a running system, you will break it! #}
{# See how tho change it here: http://dev.mysql.com/doc/refman/5.6/en/innodb-data-log-reconfiguration.html #}
{# TODO FIX -> Maybe detect a change and fail, just to be safe? #}
innodb_log_file_size = {{ mysql_innodb_log_file_size }}
2015-08-11 04:45:01 +07:00
[mysqldump]
quick
max_allowed_packet = {{ mysql_mysqldump_max_allowed_packet }}
[mysqld_safe]
pid-file = {{ mysql_pid_file }}
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
# vim: set ft=dosini :