chef-cookbooks / ssh_known_hosts

Development repository for Chef Cookbook ssh_known_hosts
https://supermarket.chef.io/cookbooks/ssh_known_hosts
Apache License 2.0
72 stars 77 forks source link

Allow cookbook to replace known_hosts file on every run #43

Closed sethrosenblum closed 8 years ago

sethrosenblum commented 9 years ago

We use the default recipe for this cookbook, and because hosts are only ever added via the ssh_known_hosts_entry provider, old nodes that have been removed from the chef server are never removed from the known_hosts file.

In addition, when building the known hosts file, the provider must do a regex scan, and then a file write and replace for every new host that's added. This causes the chef run to slow down considerably when there's a few hundred hosts to in the file.

There should be an attribute flag that allows the recipe to completely replace the ssh_known_hosts file every time chef runs, with only keys that are currently in chef, and without doing a regex search.