Problem with SSH Connection with Trellis

Hello,

I am a newbie on deployments on Trellis / Ansible

I’m trying desperately to deploy the trellis server provisioning script (ansible-playbook server.yml -e env=staging). The concern is that it uses the username of my computer instead of using the one I defined in staging / vault.
How can one specify the username for the ssh connection?

Thanks for your help.

It doesn’t by default. Where are you seeing this? Can you provide logs to show that this is the case?

What have you tried so far? Have you looked at the documentation? The user variable is listed at the top

1 Like

I modified the info in the file group_vars/staging/vault.yml

I also try to edit it in the group_vars / all / users.yml file

Here is the info at the time of ssh connection :

TASK [connection : Check whether Ansible can connect as root] *****************************************************************************************************************************************************************************************************************************************************

**task path: /Users/behaba/Sites/trellis/roles/connection/tasks/main.yml:18**

Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/commands/command.py

<localhost> ESTABLISH LOCAL CONNECTION FOR USER: behaba

<localhost> EXEC /bin/sh -c 'ANSIBLE_SSH_ARGS='"'"'-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o HostKeyAlgorithms=ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa'"'"' /usr/local/opt/python/bin/python2.7 && sleep 0'

That SSH connection isn’t trying to connect as your user, it’s trying to connect as root

This is what it’s doing: https://github.com/roots/trellis/blob/457476347b057731d649c73f5ee8bcec32bc93ad/roles/connection/tasks/main.yml#L18-L28

From the docs I linked:

User Variable admin_user

Edit group_vars/all/users.yml and update admin_user