ansible-roles/maxscale/templates/maxscale.cnf.j2
Mathieu Trossevin e22703425d Add filters and arbitrary options
(+ Make config file a bit more readable)
2020-06-29 10:04:48 +02:00

61 lines
1.7 KiB
Django/Jinja
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[maxscale]
threads = auto
{% for server in maxscale_mysql_servers %}
[{{ server['name'] }}]
type = server
address = {{ server['address'] }}
port = {{ server['port']|default(3306) }}
protocol = MariaDBBackend
{% endfor %}
[MariaDB-Monitor]
type = monitor
module = mariadbmon
servers = {% for server in maxscale_mysql_servers %}{{ server['name'] }}{% if not loop.last %}, {% endif %}{% endfor %}
user = {{ maxscale_monitor_user }}
{% if encrypted_maxscale_monitor_password is none %}
password = {{ encrypt_maxscale_monitor_password_result['stdout'] }}
{% else %}
password = {{ encrypted_maxscale_monitor_password }}
{% endif %}
monitor_interval = 2000
{% for service in maxscale_services %}
[{{ service['name'] }}-Service]
type = service
router = {{ service['router'] }}
cluster = MariaDB-Monitor
user = {{ maxscale_mysql_user }}
{% if encrypted_maxscale_mysql_password is none %}
password = {{ encrypt_maxscale_mysql_password_result['stdout'] }}
{% else %}
password = {{ encrypted_maxscale_mysql_password }}
{% endif %}
{% if service['filters'] is defined and service['filters'] %}
filters = {% for _filter in service['filters'] %}{{ _filter }}{% if not loop.last %} | {% endif %}{% endfor %}
{% endif %}
{% if service['options'] is defined %}
{% for option in service['options'] %}
{{ option['name'] }} = {{ option['value'] }}
{% endfor %}
{% endif %}
[{{ service['name'] }}-Listener]
type = listener
service = {{ service['name'] }}-Service
protocol = MariaDBClient
port = {{ service['port'] }}
{% endfor %}
{% for _filter in maxscale_filters %}
[{{ _filter['name'] }}]
type = filter
module = {{ _filter['module'] }}
{% for option in _filter['options'] %}
{{ option['name'] }} = {{ option['value'] }}
{% endfor %}
{% endfor %}