Strider-CD / strider-custom

Support for custom prepare, test and deploy phases in Strider
9 stars 7 forks source link

How to use ssh to deploy with ansible #27

Open carlitux opened 8 years ago

carlitux commented 8 years ago

ansible-playbook -i playbooks/inventory.ini playbooks/deploy.yml

PLAY [webapp] *****

GATHERING FACTS *** previous known host file not found fatal: [IP] => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue

TASK: [Git clone/update if needed from github] **** FATAL: no hosts matched or all hosts have already failed -- aborting

PLAY RECAP **** to retry, use: --limit @/home/strider/deploy.retry

knownasilya commented 8 years ago

Could you run it with the suggested -vvvv for debugging info?

carlitux commented 8 years ago
<IP> ESTABLISH CONNECTION FOR USER: deploy
<IP> REMOTE_MODULE setup
<IP> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/strider/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=deploy', '-o', 'ConnectTimeout=10', 'IP', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446037923.62-14746271877442 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446037923.62-14746271877442 && echo $HOME/.ansible/tmp/ansible-tmp-1446037923.62-14746271877442'"]
previous known host file not found
fatal: [IP] => SSH encountered an unknown error. The output was:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/strider/.ansible/cp/ansible-ssh-IP-deploy" does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to IP [IP] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address IP port 22: Connection timed out
ssh: connect to host IP port 22: Connection timed out

Maybe $HOME?

knownasilya commented 8 years ago

Looks suspicious, since you have direct references to the home folder else where in that command..

carlitux commented 8 years ago

I just did some user/permission changes and now is trying to use strider ssh key... how can use the keys from project settings like ssh-deploy plugin?

debug1: Connection established.
debug3: timeout: 9955 ms remain after connect
debug1: SELinux support disabled
debug1: identity file /home/strider/.ssh/id_rsa type -1
debug1: identity file /home/strider/.ssh/id_rsa-cert type -1
debug1: identity file /home/strider/.ssh/id_dsa type -1
debug1: identity file /home/strider/.ssh/id_dsa-cert type -1
debug1: identity file /home/strider/.ssh/id_ecdsa type -1
debug1: identity file /home/strider/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/strider/.ssh/id_ed25519 type -1
debug1: identity file /home/strider/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK