Setting the interpreter for the remote host would require boto being 
installed on the remote host, which isn't what I'm after.

Setting the variable on localhost and accessing it remotely using hostvars 
does work, however, the real issue is how ansible can't seem to find boto 
when its run inside a virtualenv for a remote host task.



On Friday, June 5, 2015 at 11:26:07 PM UTC-4, Matt Martz wrote:
>
> 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 <da...@unite.me <javascript:>> 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 ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> 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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f7823de7-dcba-40c5-8c6b-9cefd50a73eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to