diff --git a/tasks/monit.yml b/tasks/monit.yml index 9ed6eaf..713cada 100644 --- a/tasks/monit.yml +++ b/tasks/monit.yml @@ -1,7 +1,7 @@ - name: "monit | Mysql-Nutzer anlegen" mysql_user: name: "{{ monit_sql_user }}" - host: "localhost" + host: "{{ mariadb.bind_address|default('localhost') }}" password: "{{ monit_sql_password }}" state: present login_unix_socket: "{{ mysql_socket }}" diff --git a/templates/monit.j2 b/templates/monit.j2 index fe4926a..be2d530 100644 --- a/templates/monit.j2 +++ b/templates/monit.j2 @@ -5,7 +5,7 @@ check process mariadb with pidfile /var/run/mysqld/mysqld.pid {% if inventory_hostname == "orwell" or inventory_hostname == "wwwusers.sao" %} if failed host 127.0.0.1 {% else %} - if failed host {{ ansible_default_ipv4.address }} + if failed host {{ mariadb.bind_address }} {% endif %} port 3306 protocol mysql username "{{ monit_sql_user }}" password "{{ monit_sql_password }}"