Script module gives permission denied

I get permission denied when using script module. I can copy the shell script over and execute. I also can see that the temp folder ansible uses is successfully being created. I added a wait_for: timeout=30 to see if it was failing to create files in the tmp, but the wait_for python script showed up on the host.

[14:30:35] tigh:~/.ansible/tmp/ansible-tmp-1452626878.29-116073172291284 # ll

total 84

-rw------- 1 root root 79521 Jan 12 14:27 wait_for

The most obvious difference between the working hosts and the ones it fails on are that the ones it fails on require scp instead of sftp. I was wondering if script ignores scp_if_ssh=True, however I couldn’t find where the actual action is in ansible code. here is a link to the script module.

If anyone can help or point me to a location to search deeper I would appreciate it!

Information follows:

test.yml

Can you run with -vvvv to get verbose output of what ansible is
sending over the wire?

Of course!

ansible-playbook -l tigh svc_install.yml -vvvv

PLAY [cds] ********************************************************************

GATHERING FACTS ***************************************************************

ESTABLISH CONNECTION FOR USER: root

REMOTE_MODULE setup

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452875293.35-179966625107224 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452875293.35-179966625107224 && echo $HOME/.ansible/tmp/ansible-tmp-1452875293.35-179966625107224’

PUT /var/folders/yq/p2rh02yx6x7fh0m9kdnp5z140000gn/T/tmpVb9OEU TO /home/root/.ansible/tmp/ansible-tmp-1452875293.35-179966625107224/setup

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/root/.ansible/tmp/ansible-tmp-1452875293.35-179966625107224/setup; rm -rf /home/root/.ansible/tmp/ansible-tmp-1452875293.35-179966625107224/ >/dev/null 2>&1’

ok: [tigh]

TASK: [hello world] ***********************************************************

<172.16.116.150> ESTABLISH CONNECTION FOR USER: root

<172.16.116.150> REMOTE_MODULE command echo “hello world” #USE_SHELL

<172.16.116.150> EXEC sshpass -d7 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 172.16.116.150 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452875295.06-180396733702497 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452875295.06-180396733702497 && echo $HOME/.ansible/tmp/ansible-tmp-1452875295.06-180396733702497’

<172.16.116.150> PUT /var/folders/yq/p2rh02yx6x7fh0m9kdnp5z140000gn/T/tmp7aXoXV TO /root/.ansible/tmp/ansible-tmp-1452875295.06-180396733702497/command

<172.16.116.150> EXEC sshpass -d7 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 172.16.116.150 /bin/sh -c ‘LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1452875295.06-180396733702497/command; rm -rf /root/.ansible/tmp/ansible-tmp-1452875295.06-180396733702497/ >/dev/null 2>&1’

ok: [tigh → 172.16.116.150] => {“changed”: false, “cmd”: “echo "hello world"”, “delta”: “0:00:00.002600”, “end”: “2016-01-15 05:30:53.488495”, “rc”: 0, “start”: “2016-01-15 05:30:53.485895”, “stderr”: “”, “stdout”: “hello world”, “stdout_lines”: [“hello world”], “warnings”: }

TASK: [debug var=hello] *******************************************************

ESTABLISH CONNECTION FOR USER: root

ok: [tigh] => {

“var”: {

“hello”: {

“changed”: false,

“cmd”: “echo "hello world"”,

“delta”: “0:00:00.002600”,

“end”: “2016-01-15 05:30:53.488495”,

“invocation”: {

“module_args”: “echo "hello world"”,

“module_complex_args”: {},

“module_name”: “shell”

},

“rc”: 0,

“start”: “2016-01-15 05:30:53.485895”,

“stderr”: “”,

“stdout”: “hello world”,

“stdout_lines”: [

“hello world”

],

“warnings”:

}

}

}

TASK: [test delegate script] **************************************************

<172.16.116.150> ESTABLISH CONNECTION FOR USER: root

<172.16.116.150> EXEC sshpass -d9 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 172.16.116.150 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296 && echo $HOME/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296’

<172.16.116.150> PUT /Users/brianwilliams/Projects/ansible/version.sh TO /root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh

<172.16.116.150> EXEC sshpass -d9 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 172.16.116.150 /bin/sh -c ‘chmod +rx /root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh’

<172.16.116.150> EXEC sshpass -d9 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 172.16.116.150 LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh

<172.16.116.150> EXEC sshpass -d9 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 172.16.116.150 /bin/sh -c ‘rm -rf /root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/ >/dev/null 2>&1’

changed: [tigh → 172.16.116.150] => {“changed”: true, “rc”: 0, “stderr”: “OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011\ndebug1: Reading configuration data /etc/ssh_config\r\ndebug1: /etc/ssh_config line 20: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 90681\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 172.16.116.150 closed.\r\n”, “stdout”: “+ /act/bin/udsinfo lsversion\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 10: /act/bin/udsinfo: No such file or directory\r\n+ grep ‘’ /act/tomcat/webapps/ROOT/update.xml\r\ngrep: /act/tomcat/webapps/ROOT/update.xml: No such file or directory\r\n+ /act/bin/adhd -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 12: /act/bin/adhd: No such file or directory\r\n+ /act/bin/omd -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 13: /act/bin/omd: No such file or directory\r\n+ /act/bin/udppm version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 14: /act/bin/udppm: No such file or directory\r\n+ /act/bin/dedup_stat -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 15: /act/bin/dedup_stat: No such file or directory\r\n+ /act/bin/openssl version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 16: /act/bin/openssl: No such file or directory\r\n+ rpm -qa openssl\r\nopenssl-1.0.1e-42.el6_7.2.x86_64\r\n+ /act/bin/openvpn --version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 19: /act/bin/openvpn: No such file or directory\r\n+ /act/bin/udpmqd -v\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 20: /act/bin/udpmqd: No such file or directory\r\n+ /act/postgresql/bin/psql -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 21: /act/postgresql/bin/psql: No such file or directory\r\n+ /act/jre/bin/java -version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 22: /act/jre/bin/java: No such file or directory\r\n+ grep version\r\n+ udppm status\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 23: udppm: command not found\r\n+ rpm -qi actsys-svc\r\npackage actsys-svc is not installed\r\n+ ls -l /act/pg/connector/\r\nls: cannot access /act/pg/connector/: No such file or directory\r\n+ ls -lt /act/lib64/libvitesse.so\r\nls: cannot access /act/lib64/libvitesse.so: No such file or directory\r\n+ ls -lt /act/libvddk/lib64/\r\nls: cannot access /act/libvddk/lib64/: No such file or directory\r\n+ set +x\r\nls: cannot access /act/tomcat/webapps/: No such file or directory\r\nls: cannot access /act/tomcat/webapps/actifio/WEB-INF/classes/: No such file or directory\r\n”}

TASK: [debug var=hey] *********************************************************

ESTABLISH CONNECTION FOR USER: root

ok: [tigh] => {

“var”: {

“hey”: {

“changed”: true,

“invocation”: {

“module_args”: “version.sh”,

“module_complex_args”: {},

“module_name”: “script”

},

“rc”: 0,

“stderr”: “OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011\ndebug1: Reading configuration data /etc/ssh_config\r\ndebug1: /etc/ssh_config line 20: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 90681\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 172.16.116.150 closed.\r\n”,

“stdout”: “+ /act/bin/udsinfo lsversion\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 10: /act/bin/udsinfo: No such file or directory\r\n+ grep ‘’ /act/tomcat/webapps/ROOT/update.xml\r\ngrep: /act/tomcat/webapps/ROOT/update.xml: No such file or directory\r\n+ /act/bin/adhd -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 12: /act/bin/adhd: No such file or directory\r\n+ /act/bin/omd -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 13: /act/bin/omd: No such file or directory\r\n+ /act/bin/udppm version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 14: /act/bin/udppm: No such file or directory\r\n+ /act/bin/dedup_stat -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 15: /act/bin/dedup_stat: No such file or directory\r\n+ /act/bin/openssl version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 16: /act/bin/openssl: No such file or directory\r\n+ rpm -qa openssl\r\nopenssl-1.0.1e-42.el6_7.2.x86_64\r\n+ /act/bin/openvpn --version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 19: /act/bin/openvpn: No such file or directory\r\n+ /act/bin/udpmqd -v\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 20: /act/bin/udpmqd: No such file or directory\r\n+ /act/postgresql/bin/psql -V\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 21: /act/postgresql/bin/psql: No such file or directory\r\n+ /act/jre/bin/java -version\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 22: /act/jre/bin/java: No such file or directory\r\n+ grep version\r\n+ udppm status\r\n/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 23: udppm: command not found\r\n+ rpm -qi actsys-svc\r\npackage actsys-svc is not installed\r\n+ ls -l /act/pg/connector/\r\nls: cannot access /act/pg/connector/: No such file or directory\r\n+ ls -lt /act/lib64/libvitesse.so\r\nls: cannot access /act/lib64/libvitesse.so: No such file or directory\r\n+ ls -lt /act/libvddk/lib64/\r\nls: cannot access /act/libvddk/lib64/: No such file or directory\r\n+ set +x\r\nls: cannot access /act/tomcat/webapps/: No such file or directory\r\nls: cannot access /act/tomcat/webapps/actifio/WEB-INF/classes/: No such file or directory\r\n”,

“stdout_lines”: [

“+ /act/bin/udsinfo lsversion”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 10: /act/bin/udsinfo: No such file or directory”,

“+ grep ‘’ /act/tomcat/webapps/ROOT/update.xml”,

“grep: /act/tomcat/webapps/ROOT/update.xml: No such file or directory”,

“+ /act/bin/adhd -V”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 12: /act/bin/adhd: No such file or directory”,

“+ /act/bin/omd -V”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 13: /act/bin/omd: No such file or directory”,

“+ /act/bin/udppm version”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 14: /act/bin/udppm: No such file or directory”,

“+ /act/bin/dedup_stat -V”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 15: /act/bin/dedup_stat: No such file or directory”,

“+ /act/bin/openssl version”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 16: /act/bin/openssl: No such file or directory”,

“+ rpm -qa openssl”,

“openssl-1.0.1e-42.el6_7.2.x86_64”,

“+ /act/bin/openvpn --version”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 19: /act/bin/openvpn: No such file or directory”,

“+ /act/bin/udpmqd -v”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 20: /act/bin/udpmqd: No such file or directory”,

“+ /act/postgresql/bin/psql -V”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 21: /act/postgresql/bin/psql: No such file or directory”,

“+ /act/jre/bin/java -version”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 22: /act/jre/bin/java: No such file or directory”,

“+ grep version”,

“+ udppm status”,

“/root/.ansible/tmp/ansible-tmp-1452875297.35-144079058810296/version.sh: line 23: udppm: command not found”,

“+ rpm -qi actsys-svc”,

“package actsys-svc is not installed”,

“+ ls -l /act/pg/connector/”,

“ls: cannot access /act/pg/connector/: No such file or directory”,

“+ ls -lt /act/lib64/libvitesse.so”,

“ls: cannot access /act/lib64/libvitesse.so: No such file or directory”,

“+ ls -lt /act/libvddk/lib64/”,

“ls: cannot access /act/libvddk/lib64/: No such file or directory”,

“+ set +x”,

“ls: cannot access /act/tomcat/webapps/: No such file or directory”,

“ls: cannot access /act/tomcat/webapps/actifio/WEB-INF/classes/: No such file or directory”

]

}

}

}

TASK: [copy src=version.sh dest=/home/root/version.sh owner=root group=root mode=“u=rwx,g=r,o=r”] ***

ESTABLISH CONNECTION FOR USER: root

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘rc=flag; [ -r /home/root/version.sh ] || rc=2; [ -f /home/root/version.sh ] || rc=1; [ -d /home/root/version.sh ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != “xflag” ] && echo "${rc} “/home/root/version.sh && exit 0; (python -c '”’“'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1(); afile = open(”‘"’“‘/home/root/version.sh’”‘"’“, “rb”) buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'”‘"’ 2>/dev/null) || (python -c ‘"’“'import sha; BLOCKSIZE = 65536; hasher = sha.sha(); afile = open(”‘"’“‘/home/root/version.sh’”‘"’“, “rb”) buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'”‘"’ 2>/dev/null) || (echo ‘"’“'0 '”‘"’/home/root/version.sh)’

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452875298.25-216765394989446 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452875298.25-216765394989446 && echo $HOME/.ansible/tmp/ansible-tmp-1452875298.25-216765394989446’

PUT /var/folders/yq/p2rh02yx6x7fh0m9kdnp5z140000gn/T/tmpxxzVvq TO /home/root/.ansible/tmp/ansible-tmp-1452875298.25-216765394989446/file

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/root/.ansible/tmp/ansible-tmp-1452875298.25-216765394989446/file; rm -rf /home/root/.ansible/tmp/ansible-tmp-1452875298.25-216765394989446/ >/dev/null 2>&1’

ok: [tigh] => {“changed”: false, “checksum”: “c95310cd879a119d3f2f46f34b680b5572c7e1bc”, “dest”: “/home/root/version.sh”, “gid”: 0, “group”: “root”, “mode”: “0744”, “owner”: “root”, “path”: “/home/root/version.sh”, “size”: 2076, “state”: “file”, “uid”: 0}

TASK: [shell /home/root/version.sh] *******************************************

ESTABLISH CONNECTION FOR USER: root

REMOTE_MODULE command /home/root/version.sh #USE_SHELL

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452875298.52-68433723337898 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452875298.52-68433723337898 && echo $HOME/.ansible/tmp/ansible-tmp-1452875298.52-68433723337898’

PUT /var/folders/yq/p2rh02yx6x7fh0m9kdnp5z140000gn/T/tmp__YSub TO /home/root/.ansible/tmp/ansible-tmp-1452875298.52-68433723337898/command

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/root/.ansible/tmp/ansible-tmp-1452875298.52-68433723337898/command; rm -rf /home/root/.ansible/tmp/ansible-tmp-1452875298.52-68433723337898/ >/dev/null 2>&1’

changed: [tigh] => {“changed”: true, “cmd”: “/home/root/version.sh”, “delta”: “0:00:00.327485”, “end”: “2016-01-15 11:27:33.269125”, “rc”: 0, “start”: “2016-01-15 11:27:32.941640”, “stderr”: “”, “stdout”: “+ /act/bin/udsinfo lsversion\nversion installed component\n6.2.1.65329 2016-01-08 15:42:26 CDS\n6.2.1.65329 2016-01-08 15:42:26 psrv-revision\n+ grep ‘’ /act/tomcat/webapps/ROOT/update.xml\n\t6.2.1.65329\r\n+ /act/bin/adhd -V\n6.2.1.65329\n$HeadURL: https://svn.actifio.com/svn/UDS/branches/sp-6.2.1/adhd/adhd.c $ \n+ /act/bin/omd -V\n6.2.1.65329\n+ /act/bin/udppm version\nUDS Data Protector Policy Manager (udppm), Version 6.2.1.65329\n+ /act/bin/dedup_stat -V\n6.2.1.65329\n+ /act/bin/openssl version\nOpenSSL 1.0.1e-fips 11 Feb 2013\n+ rpm -qa openssl\nopenssl-1.0.1e-42.el6_7.1.i686\nopenssl-1.0.1e-42.el6_7.1.x86_64\n+ /act/bin/openvpn --version\nOpenVPN 2.1.1 x86_64-unknown-linux-gnu [SSL] [LZO2] [EPOLL] built on Oct 28 2015\nOriginally developed by James Yonan\nCopyright (C) 2002-2009 OpenVPN Technologies, Inc. sales@openvpn.net\n+ /act/bin/udpmqd -v\n(23918|139894812551136) MuxerTask ctor 0x1de0ae8\nudpmqd, version 6.2.1.65329(23918|139894812551136) MuxerTask dtor 0x1de0ae8\n+ /act/postgresql/bin/psql -V\npsql (PostgreSQL) 8.4.22\n+ /act/jre/bin/java -version\njava version "1.7.0_91"\nJava™ SE Runtime Environment (build 1.7.0_91-b15)\nJava HotSpot™ 64-Bit Server VM (build 24.91-b03, mixed mode)\n+ udppm status\n+ grep version\n/home/root/version.sh: line 23: udppm: command not found\n+ rpm -qi actsys-svc\nName : actsys-svc Relocations: / \nVersion : 6.2.1 Vendor: (none)\nRelease : 64881 Build Date: Fri 18 Dec 2015 01:39:34 PM EST\nInstall Date: Fri 08 Jan 2016 03:28:16 PM EST Build Host: pliny-old.actifio.com\nGroup : Applications Source RPM: actsys-svc-6.2.1-64881.src.rpm\nSize : 3432465 License: Restricted\nSignature : (none)\nSummary : Actifio System Components\nDescription :\nActifio System Components\n+ ls -l /act/pg/connector/\ntotal 576148\n-rw-r–r-- 1 root root 161463808 Jan 8 15:43 connector-AIX-6.2.1.65329.bff\n-rw-r–r-- 1 root root 152463360 Jan 8 15:43 connector-HPUX-6.2.1.65329.depot\n-rw-r–r-- 1 root root 26316321 Jan 8 15:43 connector-Linux-6.2.1.65329.rpm\n-rw-r–r-- 1 root root 25956086 Jan 8 15:43 connector-Linux_x86-6.2.1.65329.rpm\n-rw-r–r-- 1 root root 122585600 Jan 8 15:43 connector-Solaris_SPARC-6.2.1.65329.pkg\n-rw-r–r-- 1 root root 81213952 Jan 8 15:43 connector-Solaris_x86-6.2.1.65329.pkg\n-rw-r–r-- 1 root root 19344784 Jan 8 15:43 connector-Win32-6.2.1.65329.exe\n+ ls -lt /act/lib64/libvitesse.so\n-rwxr-xr-x 1 act root 110449 Jan 5 10:47 /act/lib64/libvitesse.so\n+ ls -lt /act/libvddk/lib64/\ntotal 104440\nlrwxrwxrwx 1 act root 18 Jan 8 15:26 libvixDiskLib.so → libvixDiskLib.so.5\nlrwxrwxrwx 1 act root 22 Jan 8 15:26 libvixDiskLib.so.5 → libvixDiskLib.so.5.5.0\nlrwxrwxrwx 1 act root 21 Jan 8 15:26 libvixDiskLibVim.so → libvixDiskLibVim.so.5\nlrwxrwxrwx 1 act root 25 Jan 8 15:26 libvixDiskLibVim.so.5 → libvixDiskLibVim.so.5.5.0\nlrwxrwxrwx 1 act root 17 Jan 8 15:26 libvixMntapi.so → libvixMntapi.so.1\nlrwxrwxrwx 1 act root 21 Jan 8 15:26 libvixMntapi.so.1 → libvixMntapi.so.1.1.0\n-rw-r–r-- 1 act root 3826104 Sep 14 08:50 libdiskLibPlugin.so\n-rw-r–r-- 1 act root 141320 Sep 14 08:50 libexpat.so.0\n-rw-r–r-- 1 act root 12520 Sep 14 08:50 libgmodule-2.0.so.0\n-rw-r–r-- 1 act root 74274312 Sep 14 08:50 libtypes.so\n-rw-r–r-- 1 act root 1969064 Sep 14 08:50 libvixDiskLib.so.5.5.0\n-rw-r–r-- 1 act root 322352 Sep 14 08:50 libvixDiskLibVim.so.5.5.0\n-rw-r–r-- 1 act root 2264680 Sep 14 08:50 libvixMntapi.so.1.1.0\n-rw-r–r-- 1 act root 8589448 Sep 14 08:50 libvmacore.so\n-rw-r–r-- 1 act root 5125264 Sep 14 08:50 libvmomi.so\n-rw-r–r-- 1 act root 1555064 Sep 14 08:50 libcrypto.so.0.9.8\n-rw-r–r-- 1 act root 322272 Sep 14 08:50 libcurl.so.4\n-rw-r–r-- 1 act root 986352 Sep 14 08:50 libglib-2.0.so.0\n-rw-r–r-- 1 act root 273464 Sep 14 08:50 libgobject-2.0.so.0\n-rw-r–r-- 1 act root 17864 Sep 14 08:50 libgthread-2.0.so.0\n-rw-r–r-- 1 act root 6736408 Sep 14 08:50 libgvmomi.so.0\n-rw-r–r-- 1 act root 336648 Sep 14 08:50 libssl.so.0.9.8\n+ set +x\nPass: actifio.war timestamp (20160105-10471452008864) older than component /act/tomcat/webapps/actifio/WEB-INF/classes/con (20160108-15421452285744)”, “warnings”: }

TASK: [run svc install] *******************************************************

ESTABLISH CONNECTION FOR USER: root

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006 && echo $HOME/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006’

PUT /Users/brianwilliams/Projects/ansible/version.sh TO /home/root/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006/version.sh

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘chmod +rx /home/root/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006/version.sh’

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /home/root/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006/version.sh

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/brianwilliams/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o Port=26 -o IdentityFile=“/Users/brianwilliams/.ssh/brianwilliams/brianwilliams-v2-key” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 tigh /bin/sh -c ‘rm -rf /home/root/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006/ >/dev/null 2>&1’

failed: [tigh] => {“changed”: true, “rc”: 126}

stderr: OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011

debug1: Reading configuration data /etc/ssh_config

debug1: /etc/ssh_config line 20: Applying options for *

debug1: auto-mux: Trying existing master

debug2: fd 3 setting O_NONBLOCK

debug2: mux_client_hello_exchange: master version 4

debug3: mux_client_forwards: request forwardings: 0 local, 0 remote

debug3: mux_client_request_session: entering

debug3: mux_client_request_alive: entering

debug3: mux_client_request_alive: done pid = 90672

debug3: mux_client_request_session: session request sent

debug1: mux_client_request_session: master session id: 2

debug3: mux_client_read_packet: read header failed: Broken pipe

debug2: Received exit status from master 126

Shared connection to tigh closed.

stdout: bash: /home/root/.ansible/tmp/ansible-tmp-1452875299.07-81351325479006/version.sh: Permission denied

FATAL: all hosts have already failed – aborting

PLAY RECAP ********************************************************************

to retry, use: --limit @/Users/brianwilliams/svc_install.retry

tigh : ok=7 changed=2 unreachable=0 failed=1

What version of ansible are you using? What operating systems are
these running between?

Everything looks correct in the output. And it's working here with
similar output on both 1.9.4 and 2.0.0. One thing I do notice is
different between your script run on your working and non-working box
is the home directory of root. So this is something of a long shot
but is /home/root/ mounted with noexec? If so that might explain why
we aren't able to execute this using script: on the non-working box.
noexec would cause 1.9.4 to fail when you run it via shell I think,
though, but there might be an older version of ansible where the way
we invoke the command via shell: would work around that (if the
command that is handed to subprocess ends up being "/bin/sh
/home/root/version.sh" then it would work despite noexec).

-Toshio

Ansible version 1.9.4. (I upgraded to 2.0.0 same problem)

“ansible_distribution”: “CentOS”,

“ansible_distribution_major_version”: “6”,

“ansible_distribution_release”: “Final”,

“ansible_distribution_version”: “6.6”

/home isn’t noexec

/dev/sda12 on /home type ext3 (rw,nosuid,relatime,errors=continue,barrier=1,data=ordered)

I simplified the playbook above to emphasize the problem: