My environment is composed of 2 web servers and 2 db servers.
I have a new developer coming in my team. I need to deploy his ssh key on every server.
He must be able to connect with both user ubuntu
and www-data
on the web servers and with user ubuntu
on the db servers.
My servers are provisioned with Ansible.
How can I do it ?
I solved it by creating a ssh-keys task like so.
In
roles/ssh-keys/tasks/main.yml
:In
roles/ssh-keys/files/authorized_keys
:In
hosts/production
:Then in
playbook.yml
:With this solution, I can manage every combination of server / user to deploy key on.