Trellis - SSH [UNREACHABLE! => {"changed": false, "unreachable": true}] Error

Hello Friends,

I’m new to using Trellis, in the process I learn somewhat about ansible (task Automation) and vagrant boxes, Using couple of tutorials (mentioned below), I tried to setup a trellis based application on my digital ocean server.

Tutorial links:


System:

My PC: Ubuntu 16.04
Digital Ocean Server: ubuntu 16.04.2
Ansible: 2.3.0.0
vagrant : 1.9.4

Based on the tutorial I successfully installed the trellis and the development version works fine on my local system.

Now, I tried to deploy it to digital ocean via one of the gitlab repo hosted on my client’s server. I changed the values into the wordpress_sites.yml and vault.yml (for production) and changed the relevant data into the users.yml file as well.

when I run “ansible-playbook server.yml -e env=production” it works fine. After that when I run “./bin/deploy.sh production <mydomain.com>” then It gives me the error of SSH, unreachable.

PLAY [Deploy WP site] **************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************
System info:
  Ansible 2.3.0.0; Linux
  Trellis at "Add Vagrant config"
---------------------------------------------------
SSH Error: data could not be sent to remote host "<serverip>". Make sure
this host can be reached over ssh
fatal: <serverip>: UNREACHABLE! => {"changed": false, "unreachable": true}
to retry, use: --limit @<projectroot>/trellis/deploy.retry

PLAY RECAP *************************************************************************************************************************************************************
<serverip>               : ok=2    changed=0    unreachable=1    failed=0   
localhost                  : ok=0    changed=0    unreachable=0    failed=0

I did the following tries.

  1. connect Digitalocean server via ssh from my local - connected
  2. ssh into vagrant, then connect to digitalocean server via ssh - connected
  3. ssh into digitalocean and tried to clone gitlab repo from digitalocean server, It connects via https link with password, but gives permission denied (publickey) error, when tried simple clone via ssh.

I guess this is something related to gitlab repo and digital ocean, but I can’t figure out what. Can you guys please help/guide me.

Thanks,
Dilip Gupta

the unreachable issue got resolved once I added my ssh-agent using this command

ssh-add ~/.ssh/id_rsa

but now another issue is occuring,

ssh-keygen failed (rc=255,stdout='',stderr='do_known_hosts: hostkeys_foreach
failed: Permission denied
')

If you had previously tried some manual debugging stuff (such as cloning etc) maybe you affected permissions? You could always reset your droplet and start fresh again now that you solved the original problem.

Dear @swalkinshaw, I did created the full new droplet and started the whole process again 2-3 times.

I successfully did deployed the trellis by using the github public repo, but when I use gitlab repo then that time it give me error

---------------------------------------------------
Git repo git@gitlabrepo/wordpress-starter.git cannot be accessed. Please
verify the repository exists and you have SSH forwarding set up correctly.
More info:
> https://roots.io/trellis/docs/deploys/#ssh-keys
> https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-
agent-forwarding

fatal: [serverip]: FAILED! => {"changed": false, "failed": true}
	to retry, use: --limit @deploy.retry

PLAY RECAP *************************************************************************************************************************************************************
serverip              : ok=7    changed=0    unreachable=0    failed=1   
localhost                  : ok=0    changed=0    unreachable=0    failed=0   

I did checked my ssh ForwardAgent and droplets AllowForwardAgent, all are working fine, in local, vagrant and droplet setup.

I checked multiple threads, and see that this kind of issue has been faced by many, but their solution didn’t worked for me.

Can you please tell me if I’m missing any key points.

My bad, the issue fixed by your comment on Can't deploy -

I needed to ssh -T git@bitbucket.com via web user.

Thanks You!

1 Like