MYSQL Connectivity Issue in Ansible

Hello,

I have the below task

mysql_user: login_user={{ db_user_root }} login_password={{ db_pass_root }} name={{ db_user }} password={{ db_pass }} priv=.:ALL,GRANT state=present

We’re facing issue on running this, from machine B to install on machine A. Installing from machine A to machine B is running fine.

However, by specifying login_host parameter this works fine.

But, the same parameter is not essential while running from A to B.

What could be the scenario?? why is that login_host parameter is required when running from B to A and not vice versa.

Thanks in advance,

Mona G

Hello,

I have the below task

mysql_user: login_user={{ db_user_root }} login_password={{ db_pass_root
}} name={{ db_user }} password={{ db_pass }} priv=*.*:ALL,GRANT
state=present

We're facing issue on running this, from machine B to install on machine
A. Installing from machine A to machine B is running fine.

However, by specifying login_host parameter this works fine.

But, the same parameter is not essential while running from A to B.

What could be the scenario?? why is that login_host parameter is
required when running from B to A and not vice versa.

I would be guessing, because you do not give enough information.
I presume that your server my.cnf bind only to an IP on machine A, while machine B has a UNIX socket connection, the default MySQL python module uses a UNIX socket connection, while you can override that by using the 'login_host' variable and then the module will use a TCP socket
Another possibility is that your user running the Ansible task has a .my.cnf in $HOME which overrides the default host value, so you need to specify the correct one manually

However this is a wild guess, for a better answer, more information is required.

Thanks in advance,

Mona G

Regards,
Tosh.

Dear Tosh,

Thanks a lot for your response :slight_smile:
We are checking on the parameters that you mentioned.
Can you list out what more information is required for a better analysis of the same.

Regards,
Mona G

    > Hello,
    >
    > I have the below task
    >
    > mysql_user: login_user={{ db_user_root }} login_password={{
    db_pass_root
    > }} name={{ db_user }} password={{ db_pass }} priv=*.*:ALL,GRANT
    > state=present
    >
    > We're facing issue on running this, from machine B to install on
    machine
    > A. Installing from machine A to machine B is running fine.
    >
    > However, by specifying login_host parameter this works fine.
    >
    > But, the same parameter is not essential while running from A to B.
    >
    > What could be the scenario?? why is that login_host parameter is
    > required when running from B to A and not vice versa.

    I would be guessing, because you do not give enough information.
    I presume that your server my.cnf bind only to an IP on machine A,
    while
    machine B has a UNIX socket connection, the default MySQL python module
    uses a UNIX socket connection, while you can override that by using the
    'login_host' variable and then the module will use a TCP socket
    Another possibility is that your user running the Ansible task has a
    .my.cnf in $HOME which overrides the default host value, so you need to
    specify the correct one manually

    However this is a wild guess, for a better answer, more information is
    required.

    >
    > Thanks in advance,
    >
    > Mona G
    Regards,
    Tosh.

Mona,

Dear Tosh,

Thanks a lot for your response :slight_smile:
We are checking on the parameters that you mentioned.
Can you list out what more information is required for a better
analysis of the same.

Well, Ansible log, MySQL logs and configs
I do not think it is actually Ansible.
Remember to sanitized all credentials.

Regards,
Mona G

Regards,
Tosh.