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): 
 ************
<localhost> REMOTE_MODULE ov_server name=demo-web1 
server_template=hj-10g-2nics oneview_host=10.16.160.10 
password=VALUE_HIDDEN username=Administrator
<localhost> 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']
<localhost> PUT /var/folders/2x/qq644rfs5yj4mpp23f8pzf4c0000gn/T/tmpYGvCV4 
TO 
/Users/hongjun/.ansible/tmp/ansible-tmp-1455927226.24-75561180686835/ov_server
<localhost> 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

-- 
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/3e9dfe46-4b77-460a-96bd-7f594e1413c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to