dj-wasabi/ansible-zabbix-proxy

Mysql database error

Opened this issue · 4 comments

Hello dj-wasabi,

When i want to use mysql database, i have an error :

TASK [dj-wasabi.zabbix-proxy : MySQL | Create database] **************************************************************************
fatal: [proxy04-prd.test.net -> proxy04-prd.test.net]: FAILED! => {"changed": false, "failed": true, "msg": "unable to find /root/.my.cnf. Exception message: (2002, \"Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)\")"}
        to retry, use: --limit @.....

Am I the only one ?

Regards,
zab35

Hi @zab35

Have you configured to use a mysql role?
If not, please use that and make sure it is executed before applying this role.

Kind regards,
Werner

yes i use a mysql role

But zabbix proxy role searches for .my.cnf file in /root.
Mysql role puts this file in /etc/mysql/my.cnf
If i do cp /etc/mysql/my.cnf /root/.my.cnf
It works
I'm not sure if this should be corrected in your role.

Regards,
zab35

OS: ubuntu 16.04

I have found a fix

in this file : roles/dj-wasabi.zabbix-proxy/tasks/mysql.yml

I have added

login_user: "{{ db_admin  }}"
login_password: "{{ db_pass }}"

to the tasks :

  • name: "MySQL | Create database"
  • name: "MySQL | Create database user"
  • name: "MySQL | Create database and import file"

The db_admin and db_pass are in the groupvar file.

Regards,
zab35

Hi @zab35

I believe a similar issue was found with the zabbix-server. Will make sure to apply the same fix on this role as well.