ansible & virtualenv

I’m using a custom module that calls out to boto, but when I run the
module, it get the following error:

failed: [localhost] => {“failed”: true, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/Users/jmartin/.ansible/tmp/
ansible-1356307230.15-113161473433942/botoec2”,
line 99, in
import boto.ec2
ImportError: No module named boto.ec2

I’m sure that boto is installed in my virtualenv, as is ansible:

(ansible)Jamess-MacBook-Air:ansible-riak jmartin$ lssitepackages |grep
-E ‘boto|ansible’
ansible
ansible-0.9-py2.7.egg-info
boto
boto-2.6.0-py2.7.egg-info

My question is, how can I get ansible to honor my virtualenv when
executing a custom module that runs locally?

Thanks,

James

James Martin wrote:

I'm using a custom module that calls out to boto, but when I run the
module, it get the following error:

failed: [localhost] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
  File "/Users/jmartin/.ansible/tmp/
ansible-1356307230.15-113161473433942/botoec2",
line 99, in <module>
    import boto.ec2
ImportError: No module named boto.ec2

I'm sure that boto is installed in my virtualenv, as is ansible:

(ansible)Jamess-MacBook-Air:ansible-riak jmartin$ lssitepackages |grep
-E 'boto|ansible'
ansible
ansible-0.9-py2.7.egg-info
boto
boto-2.6.0-py2.7.egg-info

My question is, how can I get ansible to honor my virtualenv when
executing a custom module that runs locally?

Set a host variable for 127.0.0.1 of ansible_python_interpreter to your
virtualenv's Python interpreter.

Daniel