ansible-role-mariadb-debian/templates/mariadb.cnf.j2

55 lines
1.3 KiB
Django/Jinja

# {{ ansible_managed }}
[mariadb]
# Basic settings
{{ mariadb_basic_settings_raw }}
# Fine tuning
{{ mariadb_fine_tuning_raw }}
# Logging
{% if mariadb_replication_role != '' %}
# warning log-basename is defined later for replication
# some log option may be ignored.
# see: https://mariadb.com/kb/en/mysqld-options/#-log-basename
{% endif %}
{{ mariadb_logging_raw }}
# Query cache
{{ mariadb_query_cache_raw }}
# Character sets
{{ mariadb_character_sets_raw }}
# InnoDB
{{ mariadb_innodb_raw }}
{% if mariadb_replication_role != '' %}
# Replication
server-id = {{ mariadb_server_id }}
log-basename = mariadb
{% if mariadb_replication_role == 'primary' %}
log_bin
expire_logs_days = {{ mariadb_expire_logs_days }}
max_binlog_size = {{ mariadb_max_binlog_size }}
binlog_format = {{mariadb_binlog_format}}
# the following permits to simplify the process of moving a replica to a
# primary node role by ensuring that replication is not started on primary node
skip-slave-start
{% for db in mariadb_databases %}
{% if db.replicate|default(false) %}
binlog_do_db = {{ db.name }}
{% else %}
binlog_ignore_db = {{ db.name }}
{% endif %}
{% endfor %}
{% endif %}
{% if mariadb_replication_role == 'replica' %}
read_only
relay-log = relay-bin
relay-log-index = relay-bin.index
{% endif %}
{% endif -%}
[mysqldump]
{{ mariadb_mysqldump_raw }}