This is a Ansible Playbook to automate the process of granting / revoking SSH access to a group of servers instances to a new user
- You must have Ansible 2.3 installed.
Ansible playbook is installed on Retelit Network under server retelit12.retelit.it (10.200.7.147) under /root/ssh-access-manager
- Add hosts in
inventory/{hcs,retelit-server}/hosts
file. See the given hosts file to add hosts. - Add public key in
roles/public-keys/
. e.g if we grant access for john doe user, copy and rename public key into that path likeroles/public-keys/luigi_molinaro/luigi_molinaro.id_rsa.pub
- Run command
ansible-playbook -i inventory -e "access={grant|revoke} ssh_user={SSH_USER} user={USER}" --tag={del_user|add_user}
#GRANT
ansible-playbook -i inventory -e "access=grant ssh_user=luigi_molinaro user=fsp" hcs.yml
ansible-playbook -i inventory -e "access=revoke ssh_user=luigi_molinaro user=fsp" hcs.yml
ansible-playbook -i inventory -e "access=grant ssh_user=luigi_molinaro user=fsp hcs.yml" --tag=add_user
ansible-playbook -i inventory -e "access=revoke ssh_user=luigi_molinaro user=fsp hcs.yml" --tag=del_user