Failure to establish connection when provisioning via ansible-playbook server.yml

Trellis expects that you do have a public key on the server prior to running any Trellis commands. You typically do not have to manually create a user.

When you create a VPS with a provider like DigitalOcean or AWS, they typically give you the option to put your public key on the VPS at creation time. By default, DigitalOcean puts this public key in the root user’s authorized_keys and AWS puts the key in the ubuntu user’s authorized_keys. In neither case do you have to do more than that. You don’t have to manually create another user.

If you use DigitalOcean or a VPS provider that allows root then server.yml should manage to just connect as root (assuming you did associate a public key with the VPS at creation time). If you use AWS or a provider that doesn’t allow root, change admin_user to the user name allowed by the provider (e.g., ubuntu for AWS), then server.yml should have no trouble connecting.

In short, if you can connect via ssh root@my_server_ip then you should be able to run server.yml as root, no problem.

For example, see the How To Embed your Public Key when Creating your Server section.

1 Like