the python mysqldb module is required

2,604 views
Skip to first unread message

nORKy

unread,
Jan 2, 2014, 8:56:49 AM1/2/14
to ansible...@googlegroups.com
Hi,
 
I have a problem with ansible 1.4.1 and 1.4.3.
 
When I start my playbook with a MySQL_db task, it says:
the python mysqldb module is required
 
 
But, in the target host, the module is present :
 
$ python
Python 2.7.6 (default, Jan  2 2014, 13:21:14)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>>
 
The target host is a FreeBSD-9.2-RELEASE
 
What is the problem ? thanks you

Michael DeHaan

unread,
Jan 2, 2014, 4:49:08 PM1/2/14
to ansible...@googlegroups.com
The problem is that you need to install the python mysqldb module to use the Ansible module.

You can install this using OS packages (preferred) or pip.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

nORKy

unread,
Jan 3, 2014, 2:45:18 AM1/3/14
to ansible...@googlegroups.com
I installed. Look my import exemple. There is no exception.
I said 'target' host but I installed on the 'server' host too.

Michael DeHaan

unread,
Jan 3, 2014, 7:57:28 AM1/3/14
to ansible...@googlegroups.com
The module is required where the task is being run, which is likely the remote host.

"There is no exception."

Yep, this is what I'd expect too! that means we are catching the error and presenting you a human readable warning instead of a traceback.


nORKy

unread,
Jan 3, 2014, 8:19:03 AM1/3/14
to ansible...@googlegroups.com
ok, so the module is installed on my remote host.
How can I have the traceback ? The module works manually not with ansible.

Michael DeHaan

unread,
Jan 3, 2014, 8:30:46 AM1/3/14
to ansible...@googlegroups.com
You don't want the traceback, proper error handling is better.

Please show the steps you have taken to have the module installed on the remote host, and the snippet of your playbook that uses it.



nORKy

unread,
Jan 7, 2014, 3:14:16 AM1/7/14
to ansible...@googlegroups.com
On my freebsd host "pkg install Py27èMySQLdb-1.2.3_2"

My task :

 - name: create db
   mysql_db:
     name:           "{{ item.1 }}"
     login_host:     "myhost"
     login_password: "mypassword"
     login_user:        "root"
     state:               present
  with_subelements:
  - users
  - db
  tags:
  - db

Berend de Boer

unread,
Aug 7, 2015, 5:16:57 PM8/7/15
to Ansible Project
For those confused by the formatting in the last email, and finding this through google, here the FreeBSD command:

  pkgng: name=databases/py-MySQLdb state=present
Reply all
Reply to author
Forward
0 new messages