I am trying to write custom module in ansible. while using `import MySQLdb` 
it is giving me error 

     failed: [127.0.0.1] => {"failed": true, "parsed": false}
    invalid output was: Traceback (most recent call last):
      File 
"/root/.ansible/tmp/ansible-1394199347.29-33439012674717/inventory", line 
11, in <module>
        import MySQLdb
    ImportError: No module named MySQLdb

Using  
*Python Version :* 2.6.6  
*MySQL-python Version :* 1.2.3

*Python Code:- *

    #!/usr/bin/python

    import datetime
    import sys
    import json
    import os
    import shlex
    import MySQLdb

    db = MySQLdb.connect("localhost","user","pwd","db_name" )
    cursor = db.cursor()
    cursor.execute("SELECT * FROM hosts")
    data = cursor.fetchone()
    print data
    db.close()


Same code working in python command line (<<<) but not working in ansible 
module.  
Is there any configuration setting need to do for ansible?? 

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/326811c6-0795-487c-9c53-9dee896dd6fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to