Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Sep 2015 00:53:19 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 202799] sysutils/ansible: SHEBANG_FILES breaks ansible_python_interpreter and makes it impossible to manage non-freebsd hosts
Message-ID:  <bug-202799-13-TyRPUy2YPX@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-202799-13@https.bugs.freebsd.org/bugzilla/>
References:  <bug-202799-13@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202799

--- Comment #2 from merlin@merlinsbox.net ---
It is incorrect to do it for the modules, direct from the ansible developers. 
Please take it up with them if you are not willing to take my word for it. 
Better yet, let's take a look at their coding guidelines:

https://github.com/ansible/ansible/blob/devel/CODING_GUIDELINES.md

"""module code should still use '/usr/bin/python' as this is replaced
automatically by 'ansible_python_interpreter', see the FAQ in the docs for more
info."""

Their code looks for that specific shebang line otherwise it cannot make use of
the variable "ansible_python_interpreter", which is necessary from FreeBSD to a
Linux target because FreeBSD keeps python in /usr/local whilst Linux keeps
python in /usr/bin.

I suspect your centos image is modified.  I do not accept the idea I should
modify all target hosts.

Here's what I did, root shell denoted by shell# and regular by shell$:

shell# cd /usr/ports/sysutils/ansible
shell# cp Makefile.orig Makefile
shell# pkg delete -y ansible
shell# portmaster sysutils/ansible

-- Now I've got the incorrectly shebang fixed modules.  I'll run ping module
against my three test machines (FreeBSD 10.2, Debian 8.1, Centos 7.1,
respectively) --

shell$ ansible -i inventory -m ping all

debiansible | FAILED >> {
    "failed": true, 
    "msg": "/bin/sh: 1: /usr/local/bin/python2.7: not found\r\nOpenSSH_6.6.1p1,
OpenSSL 1.0.1p-freebsd 9 Jul 2015\r\ndebug1: Reading configuration data
/home/merlin/.ssh/config\r\ndebug1: /home/merlin/.ssh/config line 8: Applying
options for *\r\ndebug1: Reading configuration data
/etc/ssh/ssh_config\r\ndebug1: auto-mux: Trying existing master\r\ndebug1:
mux_client_request_session: master session id: 2\r\nShared connection to
debiansible closed.\r\n", 
    "parsed": false
}

ansibeastie | success >> {
    "changed": false, 
    "ping": "pong"
}

ancentos | FAILED >> {
    "failed": true, 
    "msg": "/bin/sh: /usr/local/bin/python2.7: No such file or
directory\r\nOpenSSH_6.6.1p1, OpenSSL 1.0.1p-freebsd 9 Jul 2015\r\ndebug1:
Reading configuration data /home/merlin/.ssh/config\r\ndebug1:
/home/merlin/.ssh/config line 8: Applying options for *\r\ndebug1: Reading
configuration data /etc/ssh/ssh_config\r\ndebug1: auto-mux: Trying existing
master\r\ndebug1: mux_client_request_session: master session id: 2\r\nShared
connection to ancentos closed.\r\n", 
    "parsed": false
}

shell# cp Makefile.fixed Makefile
shell# pkg delete -y ansible
shell# portmaster sysutils/ansible

-- Now I've got the correctly NOT shebang fixed modules.  I'll run ping module
against my three test machines (FreeBSD 10.2, Debian 8.1, Centos 7.1,
respectively) --

shell$ ansible -i inventory -m ping all

debiansible | success >> {
    "changed": false, 
    "ping": "pong"
}

ansibeastie | success >> {
    "changed": false, 
    "ping": "pong"
}

ancentos | success >> {
    "changed": false, 
    "ping": "pong"
}

shell$ cat inventory

[freebsd]
ansibeastie

[debian]
debiansible

[centos]
ancentos

[freebsd:vars]
ansible_ssh_user=freebsd-admin
ansible_python_interpreter=/usr/local/bin/python2.7

[debian:vars]
ansible_ssh_user=debian-admin
ansible_python_interpreter=/usr/bin/python

[centos:vars]
ansible_ssh_user=centos-admin
ansible_python_interpreter=/usr/bin/python

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-202799-13-TyRPUy2YPX>