{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/13421","labels_url":"https://api.github.com/repos/ansible/ansible/issues/13421/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/13421/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/13421/events","html_url":"https://github.com/ansible/ansible/issues/13421","id":120296866,"number":13421,"title":"Unable to override local python interpreter with \"connection: local\" unless on localhost","user":{"login":"copumpkin","id":2623,"avatar_url":"https://avatars.githubusercontent.com/u/2623?v=3","gravatar_id":"","url":"https://api.github.com/users/copumpkin","html_url":"https://github.com/copumpkin","followers_url":"https://api.github.com/users/copumpkin/followers","following_url":"https://api.github.com/users/copumpkin/following{/other_user}","gists_url":"https://api.github.com/users/copumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/copumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copumpkin/subscriptions","organizations_url":"https://api.github.com/users/copumpkin/orgs","repos_url":"https://api.github.com/users/copumpkin/repos","events_url":"https://api.github.com/users/copumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/copumpkin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/7","html_url":"https://github.com/ansible/ansible/milestones/stable-1.9","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/7/labels","id":1326964,"number":7,"title":"stable-1.9","description":"","creator":{"login":"jimi-c","id":26403,"avatar_url":"https://avatars.githubusercontent.com/u/26403?v=3","gravatar_id":"","url":"https://api.github.com/users/jimi-c","html_url":"https://github.com/jimi-c","followers_url":"https://api.github.com/users/jimi-c/followers","following_url":"https://api.github.com/users/jimi-c/following{/other_user}","gists_url":"https://api.github.com/users/jimi-c/gists{/gist_id}","starred_url":"https://api.github.com/users/jimi-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimi-c/subscriptions","organizations_url":"https://api.github.com/users/jimi-c/orgs","repos_url":"https://api.github.com/users/jimi-c/repos","events_url":"https://api.github.com/users/jimi-c/events{/privacy}","received_events_url":"https://api.github.com/users/jimi-c/received_events","type":"User","site_admin":false},"open_issues":38,"closed_issues":6,"state":"open","created_at":"2015-09-28T14:27:40Z","updated_at":"2016-01-07T04:27:43Z","due_on":null,"closed_at":null},"comments":20,"created_at":"2015-12-03T23:32:23Z","updated_at":"2016-01-07T14:48:34Z","closed_at":null,"body":"### Issue Type:\r\n\r\nBug report\r\n\r\n### Ansible Version:\r\n\r\n```\r\nansible 1.9.4\r\n  configured module search path = None\r\n```\r\n\r\n### Ansible Configuration:\r\n\r\nN/A, minimized below.\r\n\r\n### Environment:\r\n\r\nN/A, minimized below.\r\n\r\n### Summary:\r\n\r\nIt doesn't seem possible to override `ansible_python_interpreter` when using `connection: local`. Minimized example below. cc @bcoca whom I spoke with about this on IRC.\r\n\r\n### Steps To Reproduce:\r\n\r\ntest.yml:\r\n```yaml\r\n- hosts: localhost\r\n  tasks:\r\n    - debug:\r\n        msg: wow!\r\n\r\n- hosts: other\r\n  connection: local\r\n  tasks:\r\n    - debug:\r\n        msg: wow such local!\r\n```\r\n\r\nNow run `ansible-playbook -vvvv -i \"other,\" test.yml`\r\n\r\n### Expected Results:\r\n\r\nBoth tasks run with my custom `python` interpreter.\r\n\r\n### Actual Results:\r\n\r\nOnly the first task (running against `localhost`) uses my custom `python` interpreter. The second one, which uses `connection: local` in the context of a different host, uses `/usr/bin/python`, presumably from the shebang of the module it's running.\r\n\r\nHere's my actual log:\r\n```\r\n$ ansible-playbook -vvvv -i inventory test.yml \r\n\r\nPLAY [localhost] ************************************************************** \r\n\r\nGATHERING FACTS *************************************************************** \r\n<localhost> REMOTE_MODULE setup\r\n<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1449184980.94-175599515598394 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1449184980.94-175599515598394 && echo $HOME/.ansible/tmp/ansible-tmp-1449184980.94-175599515598394']\r\n<localhost> PUT /var/folders/f2/18n30h057611nz0cy1ng9bhc0000gn/T/tmpoj1H3_ TO /Users/copumpkin/.ansible/tmp/ansible-tmp-1449184980.94-175599515598394/setup\r\n<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /nix/store/5gzrrcw9g3477d354l5df3w6cqyjvimc-python-2.7.10/bin/python2.7 /Users/copumpkin/.ansible/tmp/ansible-tmp-1449184980.94-175599515598394/setup; rm -rf /Users/copumpkin/.ansible/tmp/ansible-tmp-1449184980.94-175599515598394/ >/dev/null 2>&1']\r\nok: [localhost]\r\n\r\nTASK: [debug ] **************************************************************** \r\nok: [localhost] => {\r\n    \"msg\": \"wow!\"\r\n}\r\n\r\nPLAY [other] ****************************************************************** \r\n\r\nGATHERING FACTS *************************************************************** \r\n<other> REMOTE_MODULE setup\r\n<other> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1449184981.75-161849069102207 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1449184981.75-161849069102207 && echo $HOME/.ansible/tmp/ansible-tmp-1449184981.75-161849069102207']\r\n<other> PUT /var/folders/f2/18n30h057611nz0cy1ng9bhc0000gn/T/tmpXztwbB TO /Users/copumpkin/.ansible/tmp/ansible-tmp-1449184981.75-161849069102207/setup\r\n<other> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/copumpkin/.ansible/tmp/ansible-tmp-1449184981.75-161849069102207/setup; rm -rf /Users/copumpkin/.ansible/tmp/ansible-tmp-1449184981.75-161849069102207/ >/dev/null 2>&1']\r\nok: [other]\r\n\r\nTASK: [debug ] **************************************************************** \r\nok: [other] => {\r\n    \"msg\": \"wow such local!\"\r\n}\r\n\r\nPLAY RECAP ******************************************************************** \r\nlocalhost                  : ok=2    changed=0    unreachable=0    failed=0   \r\nother                      : ok=2    changed=0    unreachable=0    failed=0   \r\n```\r\n\r\nNote the `/nix/store/...` python interpreter in the first task and `/usr/bin/python` in the second. The first one is also the value of `sys.executable` within `ansible-playbook`."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/169684217","html_url":"https://github.com/ansible/ansible/issues/13421#issuecomment-169684217","issue_url":"https://api.github.com/repos/ansible/ansible/issues/13421","id":169684217,"user":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T14:48:34Z","updated_at":"2016-01-07T14:48:34Z","body":"last i tested, this is NOT an issue in 2.0 and we are we are not doing a 1.9.5 release until 2.0 is out, at that point we'll look at this in depth"}}