Sometimes you want to work with other developers post launch on a Roots Trellis project. In those cases you need to only add these new users. And that means you need to add ssh keys to Trellis you did not add yet.

Ansible Tags

Fortunately you do not need to provision the whole server again. You can use Ansible tags and just run

ansible-playbook server.yml -e env=production --tags=users

These tags were added by the Roots team to run certain actions separately. Very convenient! In this case the tag users will add only the users from trellis/group_vars/all/users.yml to the server. The place where you can easily add the new ssh keys

keys:
- "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- https://github.com/existingdev.keys
- https://github.com/newdev.keys

So when you do that Ansible will see new keys were added and will update the server accordingly.

NB See also Roots Trellis documentation on this here.

Leave a Reply

Your email address will not be published. Required fields are marked *