Ansible playbook for creating mysql user not working

137 views
Skip to first unread message

Arjun Ani

unread,
Oct 30, 2018, 2:09:54 AM10/30/18
to Ansible Project

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: [94.130.87.130]: FAILED! => { "changed": false, "module_stderr": "Shared connection to 94.130.87.130 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 }

Andrew Cockerill

unread,
Oct 30, 2018, 4:56:41 AM10/30/18
to Ansible Project
That looks like an issue with the ssh connection. Can you try a couple of things:

1. Verify that you can connect using ssh

2. If you can, try a simple Ansible play like 'ping' and see if that works.

Arjun Ani

unread,
Oct 30, 2018, 5:03:45 AM10/30/18
to Ansible Project
Andrew,

Thank You for your reply.The issue is not with the ssh connection.The above is only a portion of task that I am running.I was able to execute other tasks successfully.Still not sure why I am not able to get the required output.

Andrew Cockerill

unread,
Oct 30, 2018, 5:22:53 AM10/30/18
to Ansible Project
I'm not familiar with that module, but do you have all the prereqs installed?

Andrew Cockerill

unread,
Oct 30, 2018, 5:54:02 AM10/30/18
to Ansible Project
The Ansible docs say:

  • Both login_password and login_user are required when you are passing credentials. If none are present, the module will attempt to read the credentials from ~/.my.cnf, and finally fall back to using the MySQL default login of ‘root’ with no password.

Arjun Ani

unread,
Oct 30, 2018, 5:57:29 AM10/30/18
to ansible...@googlegroups.com
MySQL server is having the user root with no password. 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/83aad499-98cf-4346-9f92-8aceb748b15d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages