I recently inherited a chef environment that has quite some stale nodes and environments and lot of old cookbooks. For e.g. the AWS console shows that I have around 150 instances running, but a knife status
shows 700 nodes.
Normally, I use ansible, so I understand how that works to a large extent. But Chef is not something I fully understand. I understand a few of the knife commands and can do basic tasks.
But things are complicated by the fact that most of the ec2 instances appear to have been created with different keys (is that a best practice?) and identifying dead nodes is further complicated.
Does chef store this information for each node i.e. what key a node was instantiated with and I can use the information to check the status of a node and perhaps automate the removal of a node?
Similarly, list environments that aren't used and delete and so on.
Is there an existing tool that I can use to clean up this chef environment? I've searched, but haven't found anything that fits the purpose. There is a tool to clean up cookbooks, but that's the least of my problems.
How would I go about cleaning this up, specifically the nodes and then any environments?
See knife plugins here
knife-cleanup
,knife-audit
andknife-ohno
could be of some help to create list of objects to be deleted.