I am experimenting with using ssh instead of paramiko. All was going well until I tried to transfer a file. Whenever I do that, it consistently fails. I have tried with “scp_if_ssh = True” and without that, and in both cases it fails. I am using Ansible 1.7. My OS is OEL6.5, which uses OpenSSH-5.3, so the ControlPersist option is not available to me. For that reason I set ssh_args to null (ssh_args = “”) and control_path is commented out. And on the remote system in the sshd_config file, I have “Subsystem sftp /usr/libexec/openssh/sftp-server”, which I have verified to be correct.
Sample output from testing is below:
With sftp:
sinudy36-> ansible sinudm07 -m copy -a “src=testfile dest=/var/tmp/” -c ssh sinudm07 | FAILED >> {
“failed”: true,
“md5sum”: “d41d8cd98f00b204e9800998ecf8427e”,
“msg”: “Source \u001b]2;pdxmft @ :/home/pdxmft\u0007/home/pdxmft/.ansible/tmp/ansible-tmp-1414537885.01-163480819509698/source failed to transfer”
}
With scp:
sinudy36-> ansible sinudm07 -m copy -a “src=testfile dest=/var/tmp/” -vvv -c ssh
ESTABLISH CONNECTION FOR USER: pdxmft
EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-q’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘sinudm07’, u’/bin/sh -c 'rc=0; [ -r “/var/tmp/testfile” ] || rc=2; [ -f “/var/tmp/testfile” ] || rc=1; [ -d “/var/tmp/testfile” ] && echo 3 && exit 0; (/usr/bin/md5sum /var/tmp/testfile 2>/dev/null) || (/sbin/md5sum -q /var/tmp/testfile 2>/dev/null) || (/usr/bin/digest -a md5 /var/tmp/testfile 2>/dev/null) || (/sbin/md5 -q /var/tmp/testfile 2>/dev/null) || (/usr/bin/md5 -n /var/tmp/testfile 2>/dev/null) || (/bin/md5 -q /var/tmp/testfile 2>/dev/null) || (/usr/bin/csum -h MD5 /var/tmp/testfile 2>/dev/null) || (/bin/csum -h MD5 /var/tmp/testfile 2>/dev/null) || (echo “${rc} /var/tmp/testfile”)'']
EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-q’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘sinudm07’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1414538299.56-158875412096061 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1414538299.56-158875412096061 && echo $HOME/.ansible/tmp/ansible-tmp-1414538299.56-158875412096061’”]
PUT /home/pdxmft/ansible/config/testfile TO /home/pdxmft/.ansible/tmp/ansible-tmp-1414538299.56-158875412096061/source
sinudm07 | FAILED => failed to transfer file to /home/pdxmft/.ansible/tmp/ansible-tmp-1414538299.56-158875412096061/source:
scp: /home/pdxmft/.ansible/tmp/ansible-tmp-1414538299.56-158875412096061/source: No such file or directory
From the testing with scp, I see that it is trying to transfer to source. Is that the name of the file on the target system, or is that the directory it is trying to copy into? If the latter, then that directory is not getting created. But either way, something is amiss here. Can anyone help with this?
Thanks,
-Mark