{% set item = item.0 %}
# {{ ansible_managed }}

[client]

{% if mariadb__server != "localhost" %}
host={{ item.server | d(mariadb__server) }}
port={{ item.server_port | d(mariadb__port) }}
{% else %}
# host={{ item.server | d(mariadb__server) }}
# port={{ item.server_port | d(mariadb__port) }}
{% endif %}
user={{ item.user | d(item.name) }}
password="{{ item.password | default(lookup('password', secret + '/mariadb/' + mariadb__delegate_to | d('undefined') + '/credentials/' + item.user | d(item.name) + '/password ' + 'length=' + mariadb__password_length)) }}"
{% if item.database|d(False) %}
database={{ item.database }}
{% endif %}
{% if item.options|d(False) %}
{{ item.options }}
{% endif %}

