Have you already tried ssh -n?
I think this could fix your problem as you are not running an
interactive session.
On 2014-05-21 17:31, Michael Peters wrote:
I'm trying to ssh within an ansible task (sounds silly, but is
actually part of a delegate_to in a playbook that streams a backup
from one server to another) but it just hangs.
I've broken it down into simple test case that fails (just hangs and a
^C doesn't kill it) and was hoping someone could help me figure out
why.
I can definitely execute the command (ssh 10.0.1.75 "ls /"') on the
db2 server directly but not using ansible from the control server.
# test.yml
---
- hosts: all
remote_user: sg
sudo: true
tasks:
- name: testing ssh
raw: 'ssh 10.0.1.86 "ls /"'
]$ ansible-playbook test.yml -l db2 -vvv
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
<10.0.1.75> ESTABLISH CONNECTION FOR USER: sg on PORT 22 TO 10.0.1.75
<10.0.1.75> REMOTE_MODULE setup
<10.0.1.75> EXEC /bin/sh -c 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1400685651.86-175650960077921 && chmod
a+rx $HOME/.ansible/tmp/ansible-tmp-1400685651.86-175650960077921 &&
echo $HOME/.ansible/tmp/ansible-tmp-1400685651.86-175650960077921'
<10.0.1.75> PUT /tmp/tmpY_IMMo TO
/home/sg/.ansible/tmp/ansible-tmp-1400685651.86-175650960077921/setup
<10.0.1.75> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via
ansible, key=adxtbqhckpioqfjghxqmtylrksipeooo] password: " -u root
/bin/sh -c '"'"'echo SUDO-SUCCESS-adxtbqhckpioqfjghxqmtylrksipeooo;
LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python
/home/sg/.ansible/tmp/ansible-tmp-1400685651.86-175650960077921/setup;
rm -rf /home/sg/.ansible/tmp/ansible-tmp-1400685651.86-175650960077921/
/dev/null 2>&1'"'"''
ok: [db2]
TASK: [testing ssh] ***********************************************************
<10.0.1.75> ESTABLISH CONNECTION FOR USER: sg on PORT 22 TO 10.0.1.75
<10.0.1.75> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via
ansible, key=tjfnvzeisbrjwbikydzfvwexomrgfmzi] password: " -u root
$SHELL -c '"'"'echo SUDO-SUCCESS-tjfnvzeisbrjwbikydzfvwexomrgfmzi; ssh
10.0.1.86 "ls /"'"'"''
And that's where it hangs indefinitely.
I assume it's some kind of ssh-within-ssh problem, but I've got git
checkouts over ssh to work with the same ansible setup. Any thoughts?
--
toscom - the open source company
Christian Rusa
Breiteneckergasse 32 1230 Wien
Mobil: 0699 10205595 Fax: 01 9249633
www.toscom.at [email protected]
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/537CDDCA.10208%40toscom.at.
For more options, visit https://groups.google.com/d/optout.