Ansible Role to Add SSH Key in-between or to Servers

If you are wondering how can you add your ssh keys to all the servers and these server keys in each other, I have an ansible script for you.

Problem we faced!

We started with only two servers with our first Shopify Application, later it grew to eight and then twelve with number of apps. Now we have over 20+ servers. Sometimes you do inter-communication only to realize that ssh key isn’t added. With every new server, it has to be done all over again – wasting an hour or two. To solve this problem I wrote this small, yet powerful ansible script.

Solution

Ansible role Intranet-Access solves this problem.

What it does

  1. It Adds your key in all the servers.
  2. It uploads public keys of all servers in each servers.

Installation


ansible-galaxy install VarunBatraIT.intranet-access

Example usage

ssh-access.yml

- hosts: servers
  roles:
     - { role: VarunBatraIT.intranet-access, USERNAME: "developer" }

ansible-playbook -i inventory.yml ssh-access.yml -kK

Ansible Role to Add SSH Key in-between or to Servers

One thought on “Ansible Role to Add SSH Key in-between or to Servers

  1. I thought someone somewhere must have wrote this go to script for every devops and I found the gold mine. Your blog is a source of a lot of knowledge.

Leave a Reply

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

Scroll to top