Cleaned up knownhosts in template

I was having some issues w/ known hosts were I would get duplicates, and sometimes it wouldn't even write valid json.  Figured I would refactor to clean things up a little bit as well. Hope you don't mind !