title: Unable to import MySQLdb in ansible module
body: <p>I am trying to write custom module in ansible. while using <code>import MySQLdb</code> it is giving me error </p>
  
  <pre><code> failed: [127.0.0.1] =&gt; {"failed": true, "parsed": false}
  invalid output was: Traceback (most recent call last):
    File "/root/.ansible/tmp/ansible-1394199347.29-33439012674717/inventory", line 11, in &lt;module&gt;
      import MySQLdb
  ImportError: No module named MySQLdb
  </code></pre>
  
  <p>Using<br>
  <strong>Python Version :</strong> 2.6.6<br>
  <strong>MySQL-python Version :</strong> 1.2.3</p>
  
  <p>Python Code:- </p>
  
  <pre><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()
  </code></pre>
  
  <p>I have written a playbook to run ansible module:-</p>
  
  <p>inventory.yaml:-</p>
  
  <pre><code>---
  - hosts: webservers
    user: root
    sudo: True
    vars:
       act: list
    tasks:
    - name: Run module inventory
      action: inventory act="{{act}}" prod="roop"
  </code></pre>
  
  <p>I'm running this playbook using below commands:-</p>
  
  <pre><code>ansible-playbook -v playboook/path/inventory.yaml 
  </code></pre>
  
  <p>Same code working in python command line (&lt;&lt;&lt;) but not working in ansible module. </p>
  
  <p>In my ansible module other code are working. 
  Is there any configuration setting need to do for ansible?? </p>