# Ansible 1.9.4 localhost ansible\_python\_interpreter breaks playbook run

**URL:** <https://forum.ansible.com/t/ansible-1-9-4-localhost-ansible-python-interpreter-breaks-playbook-run/20637>\
**Category:** Ansible Project\
**Created:** [February 20, 2016, 12:27am UTC](https://forum.ansible.com/t/ansible-1-9-4-localhost-ansible-python-interpreter-breaks-playbook-run/20637 "2016-02-20T00:27:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hongjun\_Ma](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@Hongjun\_Ma](https://forum.ansible.com/u/Hongjun_Ma)\
**Post date:** [February 20, 2016, 12:27am UTC](https://forum.ansible.com/t/ansible-1-9-4-localhost-ansible-python-interpreter-breaks-playbook-run/20637/1 "2016-02-20T00:27:17Z")

</div>

I have a playbook and I want to change python path from default /user/bin/python to /user/local/bin/python(on MAC book and brew installed latest 2.7.11 on /user/local/bin).

I setup the hosts file and add a localhost entry and set ansible\_python\_interpreter there but after that, I can see my python path got changed but playbook is not parsing my python module “ov\_server” any more. why is that?

Also, how can I keep my PYTHONPATH environment when doing ansible playbook? I can see my sys.path don’t include my PYTHONPATH anymore when executing ansible. It put some ansible directory in sys.path. I’m not sure if it’s MAC homebrew ansible installation thing or this is something I can control in Ansible.

++++++play book+++++++++

- name : Create Server Profiles  
ov\_server:  
oneview\_host: “{{ oneview }}”  
username: “{{ ov\_username }}”  
password: “{{ ov\_password }}”  
server\_template: “{{ ov\_template }}”  
name: “{{ inventory\_hostname }}”  
#server\_hardware: “{{ server\_hardware }}” Optional - if ommited, select automatically  
delegate\_to: localhost

++++++++++Host file++++++++  
…

[local]  
localhost ansible\_python\_interpreter=/usr/local/bin/python

hongjun-mac-mini:oneview-web-farm hongjun$ ansible-playbook -i ./test-env/hosts ov\_site.yml -vvv --step

PLAY [webservers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Perform task: hp-oneview-server | Create Server Profiles (y/n/c): y

Perform task: hp-oneview-server | Create Server Profiles (y/n/c): \*\*\*\*\*\*\*\*\*\*\*\*  
 REMOTE\_MODULE ov\_server name=demo-web1 server\_template=hj-10g-2nics oneview\_host=10.16.160.10 password=VALUE\_HIDDEN username=Administrator  
 EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835 && echo $HOME/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835’]  
 PUT /var/folders/2x/qq644rfs5yj4mpp23f8pzf4c0000gn/T/tmpYGvCV4 TO /Users/hongjun/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835/ov\_server  
 EXEC [‘/bin/sh’, ‘-c’, u’LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/local/bin/python /Users/hongjun/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835/ov\_server; rm -rf /Users/hongjun/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835/ \>/dev/null 2\>&1’]  
failed: [demo-web1 → localhost] =\> {“failed”: true}

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/Users/hongjun/ov\_site.retry

demo-web1 : ok=0 changed=0 unreachable=0 failed=1

Thanks  
Hongjun
