{# Copyright (C) 2015-2016 Maciej Delmanowski <drybjed@gmail.com>
 # Copyright (C) 2015-2017 DebOps <https://debops.org/>
 # SPDX-License-Identifier: GPL-3.0-only
 #}
{% set mariadb__tpl_client      = ansible_local.mariadb.client|d("localhost") %}
{% set mariadb__tpl_delegate_to = ansible_local.mariadb.delegate_to|d(mariadb_server__delegate_to) %}
{% set mariadb__tpl_host        = ansible_local.mariadb.host|d("localhost") %}
{% set mariadb__tpl_server      = ansible_local.mariadb.server|d("localhost") %}
{% if (mariadb_server__register_version.stdout or (mariadb_server__register_install_status|d() and mariadb_server__register_install_status.changed|bool)) %}
{%   set mariadb__tpl_client      = "localhost" %}
{%   set mariadb__tpl_delegate_to = mariadb_server__delegate_to %}
{%   set mariadb__tpl_host        = "localhost" %}
{%   set mariadb__tpl_server      = "localhost" %}
{% endif %}
{
"client": "{{ mariadb__tpl_client }}",
"delegate_to": "{{ mariadb__tpl_delegate_to }}",
"flavor": "{{ ansible_local.mariadb.flavor|d(mariadb_server__flavor) }}",
"host": "{{ mariadb__tpl_host }}",
"port": "{{ ansible_local.mariadb.port|d(mariadb_server__port) }}",
"server": "{{ mariadb__tpl_server }}"
}
