mysql_user – create a user on a remote host from a inventory host

Hi,

I have a simple question.
mysql_user module have some requirements,
One of them is Requires the PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) package on the remote host.

We have installed requirements on a intermediate server named serverA
Is it possible to use the module to create a user on some other servers through serverA

  • name: Création d’un compte nominatif MySql
    hosts: serverA

tasks:

  • name: “Create user on the remote host”
    mysql_user:
    login_host: serverB
    login_port: “{{ portbddServerB }}”
    login_user: admin
    login_password: passadmin
    name: myuser
    password: passuser
    login_unix_socket: null
    register: resultat

It seems that the module tries to connect the database on serverA

fatal: [serverA]: FAILED! => {“changed”: false, “msg”: “unable to connect to database, check login_user and login_password are correct or /home/mysql/.my.cnf has the credentials. Exception message: (1045, "Access denied for user ‘***’@‘serverA’ (using password: YES)")”}

thanks for your help.

it’s ok it works, that was simply a connexion problem. sorry