So set ansible_python_interpreter to the correct Python binary for the
virtualenv on the remote host.

Also, you can execute tasks on localhost and then reference it from another
host:

http://docs.ansible.com/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts

Or use local_action which will delegate to localhost, but register the car
to the remote host.

On Friday, June 5, 2015, David Pires <[email protected]> wrote:

>  ---
>>   - hosts: remote_host
>>     pre_tasks:
>>       - name: Read host
>>         connection: local
>>         route53:
>>           command: get
>>           zone: ZONE
>>           record: RECORD
>>           type: A
>>         register: host_record
>>     roles:
>>       - test
>
>
> When boto/ansible is available globally, this playbook works as expected,
> it registers the variable and can be used on a remote host.
>
> This does not work when boto/ansible is being used inside a virtualenv.
> Boto can not be found.
>
> What seems to be the issue, is ansible is using the global python version
> (which doesn't have boto) when using remote hosts.
>
> When inside the virtualenv and setting python_interpreter for localhost,
> these tasks work on localhost.
>
>
> On Friday, June 5, 2015 at 11:01:47 PM UTC-4, Brian Coca wrote:
>>
>> I'm confused, what you are stating seems to contradict itself.
>>
>  --
> 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]
> <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/efabc0bd-0952-4830-9105-bc56ac2f6d39%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/efabc0bd-0952-4830-9105-bc56ac2f6d39%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v9kqijRLB50FDf3qWL%3DUn%2BRzfSMGUSm0b4S-wKr6QG24Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to