Arjunani19135
Arjunani19135

Reputation: 23

mysql_user modue is showing error when running in centos7

When running mysql_user module in ansible it is showing the below error.

ansible version - 2.6

mysql version - 5.6

yaml syntax :-

- name: Test | mysql

  mysql_user: name=test password=test host=localhost state=present

error :-

fatal: [xx.xx.xx.xx]: FAILED! => {
    "changed": false, 
    "module_stderr": "Shared connection to xx.xx.xx.xx closed.\r\n", 
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_73s74m/ansible_module_mysql_user.py\", line 206, in <module>\r\n    from ansible.module_utils.basic import AnsibleModule\r\nzlib.error: Error -2 while preparing to decompress data: inconsistent stream state\r\n", 
    "msg": "MODULE FAILURE", 
    "rc": 1
}

Upvotes: 2

Views: 553

Answers (2)

maco1717
maco1717

Reputation: 843

I got Ansible 2.6.2, Python 2.7.12 and MySQL Ver 14.14 Distrib 5.6.42.

This sorted the issue for me.

On the server:

1 Download the version of zlib that we want to update to

wget https://zlib.net/zlib-1.2.11.tar.gz

2 Unpack the source

tar -xzf zlib-1.2.11.tar.gz

3 Get into the source

cd zlib-1.2.11/

4 Configure it Executing the next command. The prefix "/usr" is used to configure the library under this path, usually at the end it will be within "/usr/lib"

./configure --shared --prefix=/usr

5 Execute the "make" command

make

6 Execute the "make install" command

make install

7 Check symbolic links on /usr/lib

cd /usr/lib

ls -l libz*

Sample Output

-rw-r--r--. 1 root root 147170 Nov  8 01:20 libz.a
lrwxrwxrwx. 1 root root     24 Nov  8 01:21 libz.so -> ../../lib/libz.so.1.2.11 
lrwxrwxrwx. 1 root root     14 Nov  8 01:20 libz.so.1 -> libz.so.1.2.11
-rwxr-xr-x. 1 root root 117592 Nov  8 01:20 libz.so.1.2.11

After this procedure I executed the recipe again and it worked

This was found here

Upvotes: 1

zephoony
zephoony

Reputation: 13

Error info

fatal: [112.35.1.76]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 112.35.1.76 closed.\r\n",  "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_BNXyN9/ansible_module_mysql_variables.py\", line 60, in <module>\r\n    from ansible.module_utils.basic import AnsibleModule\r\nzlib.error: Error -2 while preparing to decompress data: inconsistent stream state\r\n", "msg": "MODULE FAILURE", "rc": 1}

Ansible info

[root@f8830824d94e test_playbookyml]# ansible --version
ansible 2.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.5 (default, Apr 10 2018, 17:08:37) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

Resolve

I get the same error today.When I change the params ansible_python_interpreter of 112.35.1.76 to "/usr/bin/python3.6" in my ansible hosts, it works. My ansible server's python version is python3.6 too. Maybe it can help you.

Upvotes: 0

Related Questions