Copying SSH-key
On your new server, create the management user. Password for this user is in Keepass. Once done, log into the management server as the management user. You need to copy over the ssh key for this user to the new server.
1
2
cd .ssh
ssh-copy-id -i id_ed25519.pub USER@SERVER
Test the key is working by logging onto the new server from the management server.
Append the ssh conf
Back on the management server in the .ssh folder edit the config file
1
vim config
And add in the following syntax
1
2
3
4
Host WHAT-YOU-CALLED-THE-HOST
Hostname HOSTNAME-OF-SERVER
Port SSH-PORT-NUMBER-BEING-USED
User MANAGMENT-USERNAME
By added the server into this file you will not be prompted for a username or need to give the port number that is being used for ssh
Adding to the inventory
1
cd ansible/
Edit the inventory file
1
vim inventory.yml
Add the host according to the syntax showing in this file. Once saved you can now test that the host is responding with:
1
ansible webservers -m ping
Note that “webservers” needs to be replaced with the parent of where you have placed the new server in the inventory.yml file