# delegate\_to and ansible\_python\_interpreter

**URL:** <https://forum.ansible.com/t/delegate-to-and-ansible-python-interpreter/19478>\
**Category:** Ansible Project\
**Created:** [October 11, 2015, 4:25am UTC](https://forum.ansible.com/t/delegate-to-and-ansible-python-interpreter/19478 "2015-10-11T04:25:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_DeMaria](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@Andrew\_DeMaria](https://forum.ansible.com/u/Andrew_DeMaria)\
**Post date:** [October 11, 2015, 4:25am UTC](https://forum.ansible.com/t/delegate-to-and-ansible-python-interpreter/19478/1 "2015-10-11T04:25:30Z")

</div>

Hi!

I am not having luck defining which python to use when using local\_action or delegate\_to: localhost. I am on devel at this commit (6292520c45905a01da4de9aaf0c5ce30bbd195a0). Since my project is fairly complex, I tried using the integration test (test\_delegate\_to) and ran into the same issue:

----snip------

$ make test\_delegate\_to  
ansible-playbook test\_delegate\_to.yml -i inventory -e @integration\_config.yml -v  
Using /etc/ansible/ansible.cfg as config file

PLAY \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [setup] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [testhost3]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: " File "/home/an  
drew/.ansible/tmp/ansible-tmp-1444536975.16-137980495534712/setup", line 2183\r\n excep  
t ValueError, e:\r\n ^\r\nSyntaxError: invalid syntax\r\n", “parsed”: f  
alse}

NO MORE HOSTS LEFT \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
testhost3 : ok=0 changed=0 unreachable=0 failed=1

Makefile:94: recipe for target ‘test\_delegate\_to’ failed  
make: \*\*\* [test\_delegate\_to] Error 2

----end snip----

----snip----

$ git diff  
diff --git a/test/integration/inventory b/test/integration/inventory  
index bee36ce..0ea1a00 100644  
— a/test/integration/inventory  
+++ b/test/integration/inventory  
@@ -3,7 +3,7 @@ testhost ansible\_ssh\_host=127.0.0.1 ansible\_connection=local  
testhost2 ansible\_ssh\_host=127.0.0.1 ansible\_connection=local

# For testing delegate\_to

testhost3 ansible\_ssh\_host=127.0.0.3  
-testhost4 ansible\_ssh\_host=127.0.0.4  
+testhost4 ansible\_ssh\_host=127.0.0.4 ansible\_python\_interpreter=/usr/bin/python2

# the following inline declarations are accompanied

# by (preferred) group\_vars/ and host\_vars/ variables

----end snip----

Can someone point me in the right direction?

Thanks!
