# Adding a server which isn't api managed simply

**URL:** <https://forum.ansible.com/t/adding-a-server-which-isnt-api-managed-simply/17645>\
**Category:** Ansible Project\
**Created:** [March 1, 2015, 2:09pm UTC](https://forum.ansible.com/t/adding-a-server-which-isnt-api-managed-simply/17645 "2015-03-01T14:09:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![riemers](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/riemers/32/1203_2.png) [@riemers](https://forum.ansible.com/u/riemers)\
**Post date:** [March 1, 2015, 2:09pm UTC](https://forum.ansible.com/t/adding-a-server-which-isnt-api-managed-simply/17645/1 "2015-03-01T14:09:57Z")

</div>

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](https://gist.github.com/Snelvuur/c98047999f332473ae51)

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

Erik
