FS#39153 - [ansible] "ansible_python_interpreter" setting is ignored
Attached to Project:
Community Packages
Opened by Marco Corte (marcoc) - Tuesday, 04 March 2014, 16:36 GMT
Last edited by Daniel Wallace (gtmanfred) - Thursday, 13 March 2014, 14:41 GMT
Opened by Marco Corte (marcoc) - Tuesday, 04 March 2014, 16:36 GMT
Last edited by Daniel Wallace (gtmanfred) - Thursday, 13 March 2014, 14:41 GMT
|
Details
Description:
For some tasks the "ansible_python_interpreter" setting is ignored. Steps to reproduce: Configure for example in the "hosts" inventory goast06 ansible_ssh_user=root ansible_python_interpreter=/usr/bin/python The "ping" test works with "python2" % ansible -vvvv g* -i hosts -m ping <goast06> ESTABLISH CONNECTION FOR USER: root <goast06> REMOTE_MODULE ping <goast06> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/marco/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'goast06', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1393950526.59-2658019232948 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1393950526.59-2658019232948 && echo $HOME/.ansible/tmp/ansible-tmp-1393950526.59-2658019232948'"] <goast06> PUT /tmp/tmp7gLHjB TO //.ansible/tmp/ansible-tmp-1393950526.59-2658019232948/ping <goast06> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/marco/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', 'goast06', "/bin/sh -c '/usr/bin/python2 //.ansible/tmp/ansible-tmp-1393950526.59-2658019232948/ping; rm -rf //.ansible/tmp/ansible-tmp-1393950526.59-2658019232948/ >/dev/null 2>&1'"] goast06 | success >> { "changed": false, "ping": "pong" } Michael DeHaan says that it is due to the fact that % head /usr/share/ansible/system/ping hardcodes python2 #!/usr/bin/python2 # -*- coding: utf-8 -*- # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # Actually, if I modify that line into #!/usr/bin/python The setting in the hosts inventory is taken into account. Probably in the "library" python files the change python->python2 should not be performed. |
This task depends upon
Closed by Daniel Wallace (gtmanfred)
Thursday, 13 March 2014, 14:41 GMT
Reason for closing: Implemented
Additional comments about closing: 1.5-2
Thursday, 13 March 2014, 14:41 GMT
Reason for closing: Implemented
Additional comments about closing: 1.5-2
https://groups.google.com/forum/#!topic/ansible-project/37qN2ffPqb0
find "$pkgdir/usr/share/ansible/" -type f -exec sed -i '1s:python:&2:' {} +
Of course, I have to specify "ansible_python_interpreter" for all archlinux managed nodes, but I should now be able to manage some solaris hosts where python is actually /usr/bin/python.
I am testing this tomorrow.
I could perform several tasks without any issue from the Arch Control Machine to some Ubuntu and Solaris Managed Nodes.
I agree for the incriminated line of the PKGBUILD.
This will effectively break the out-of-box experience on Archlinux<->Archlinux, (but easily fix and pointed out by the upstream documentation).
However, this will make all distributions work (Natively or letting the possibility to indicate the python shell, which is currently broken by "find "$pkgdir/usr/share/ansible/" -type f -exec sed -i '1s:python:&2:' {} +")