Hi,

When I am trying to run ansible job from my host computer to remote server 
it fails with the following error logs -


<127.0.0.12> ESTABLISH SSH CONNECTION FOR USER: ansibleuser



<127.0.0.12> SSH: EXEC sshpass -d47 ssh -vvv -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'User="ansibleuser"' -o ConnectTimeout=10 -o 
ControlPath=/Users/hostuser/.ansible/cp/0ac5f07217 127.0.0.12 '/bin/sh -c 
'"'"'( umask 77 && mkdir -p "` echo /home/ansibleuser/.ansible/tmp `"&& 
mkdir 
/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
&& echo ansible-tmp-1593435394.159632-95806-14486735064275="` echo 
/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
`" ) && sleep 0'"'"''

<127.0.0.12> (1, b'\x1b(B\x1b[m', b'OpenSSH_7.9p1, LibreSSL 
2.7.3\r\ndebug1: Reading configuration data 
/Users/hostuser/.ssh/config\r\ndebug1: /Users/hostuser/.ssh/config line 1: 
Applying options for *\r\ndebug1: Reading configuration data 
/etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying 
options for *\r\ndebug2: resolve_canonicalize: hostname 127.0.0.12 is 
address\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 = 95817\r\ndebug3: mux_client_request_session: session request 
sent\r\n/bin/sh: -c: line 0: syntax error near unexpected token 
`(\'\n/bin/sh: -c: line 0: `( umask 77 && mkdir -p "` echo 
\x1b(B\x1b[m/home/ansibleuser/.ansible/tmp `"&& mkdir 
\x1b(B\x1b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
&& echo ansible-tmp-1593435394.159632-95806-14486735064275="` echo 
\x1b(B\x1b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
`" ) && sleep 0\'\ndebug3: mux_client_read_packet: read header failed: 
Broken pipe\r\ndebug2: Received exit status from master 1\r\n')

<127.0.0.12> Failed to connect to the host via ssh: OpenSSH_7.9p1, LibreSSL 
2.7.3

debug1: Reading configuration data /Users/hostuser/.ssh/config

debug1: /Users/hostuser/.ssh/config line 1: Applying options for *

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 48: Applying options for *

debug2: resolve_canonicalize: hostname 127.0.0.12 is address

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 = 95817

debug3: mux_client_request_session: session request sent

/bin/sh: -c: line 0: syntax error near unexpected token `('

/bin/sh: -c: line 0: `( umask 77 && mkdir -p "` echo 
/home/ansibleuser/.ansible/tmp `"&& mkdir 
/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
&& echo ansible-tmp-1593435394.159632-95806-14486735064275="` echo 
/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
`" ) && sleep 0'

debug3: mux_client_read_packet: read header failed: Broken pipe

debug2: Received exit status from master 1

fatal: [127.0.0.12]: UNREACHABLE! => {

    "changed": false,

    "msg": "Failed to create temporary directory.In some cases, you may 
have been able to authenticate and did not have permissions on the target 
directory. Consider changing the remote tmp path in ansible.cfg to a path 
rooted in \"/tmp\", for more error information use -vvv. Failed command 
was: ( umask 77 && mkdir -p \"` echo 
\u001b(B\u001b[m/home/ansibleuser/.ansible/tmp `\"&& mkdir 
\u001b(B\u001b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
&& echo ansible-tmp-1593435394.159632-95806-14486735064275=\"` echo 
\u001b(B\u001b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
`\" ), exited with result 1, stdout output: \u001b(B\u001b[m, stderr 
output: OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data 
/Users/hostuser/.ssh/config\r\ndebug1: /Users/hostuser/.ssh/config line 1: 
Applying options for *\r\ndebug1: Reading configuration data 
/etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying 
options for *\r\ndebug2: resolve_canonicalize: hostname 127.0.0.12 is 
address\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 = 95817\r\ndebug3: mux_client_request_session: session request 
sent\r\n/bin/sh: -c: line 0: syntax error near unexpected token 
`('\n/bin/sh: -c: line 0: `( umask 77 && mkdir -p \"` echo 
\u001b(B\u001b[m/home/ansibleuser/.ansible/tmp `\"&& mkdir 
\u001b(B\u001b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
&& echo ansible-tmp-1593435394.159632-95806-14486735064275=\"` echo 
\u001b(B\u001b[m/home/ansibleuser/.ansible/tmp/ansible-tmp-1593435394.159632-95806-14486735064275
 
`\" ) && sleep 0'\ndebug3: mux_client_read_packet: read header failed: 
Broken pipe\r\ndebug2: Received exit status from master 1\r\n",

    "unreachable": true

}



The remote server is using Red Hat Enterprise Linux Server release 6.7 
(Santiago). I am able to run the command after SSH to the instance as 
ansibleuser - 


/bin/sh -c '( umask 77 && mkdir -p "` echo /home/ansibleuser/.ansible/tmp 
`"&& mkdir 
/home/ansibleuser/.ansible/tmp/ansible-tmp-1593432831.36716-94271-191330807976780
 
&& echo ansible-tmp-1593432831.36716-94271-191330807976780="` echo 
/home/ansibleuser/.ansible/tmp/ansible-tmp-1593432831.36716-94271-191330807976780
 
`" ) && sleep 0'

But it fails when ansible tries to run it. /bin/sh is a soft link to 
/bin/bash. Any suggestions what might be causing the issue




-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1e15dbfe-a701-485d-9477-f0179c3bcc9eo%40googlegroups.com.

Reply via email to