Adding a server which isn't api managed simply

Just wanted to share, i’am new to the whole Ansible but i did feel i still had to do work on initial servers (unlike amazon and the likes which can be automated more) so i made a simple function to do a addserver. I started out simple as a one lines but then i made some simple checks in it so others could use it too.

Basicly just a “addserver ” and it will at least place the keys and add a sudoers entry on the remote host (regardless if it has a entry in the known_hosts) assuming you use root to login remotely. After that, yes you run the playbook to harden the box and remove remote login with root etc etc.

https://gist.github.com/Snelvuur/c98047999f332473ae51

Feel free to give remarks, as i didn’t find a “this does it” on google… :slight_smile:

Erik