[client] user=root password={{ mysql_root_password }} {% if inventory_hostname not in groups["dbserver-mysql"] and mysql_default_host is defined and mysql_default_host != inventory_hostname and hostvars[mysql_default_host|default(inventory_hostname)]["ssh_tunnel_ports"] is defined %} host=127.0.0.1 port={{ hostvars[mysql_default_host|default(inventory_hostname)]["ssh_tunnel_ports"][0]["local"] }} {% else %} host=127.0.0.1 port=3306 {% endif %}