= DESCRIPTION:
****** WARNING ******************
Use of the role_count.rb is very hard on the chef server as it has to run a search on every role you have
this should not be a problem as long as you only run on one node ( not sure why you would run on more)
We have 132 servers hitting the chef server every 30 minutes with 60 roles and it takes 75 seconds to run
in our env.
****** You have been warned ******
My developers and VP want to know how servers are being used, so I embed the page generated by this cookbook in our wiki and its always up to date!
Uses a simple javascript sort that I found at http://yoast.com/articles/sortable-table/
Whats on the page that is generated:
default.rb:
A time stamp of the page generation
A html tabe giving the following for each node
<tr>
<th width="13%">Name</th>
<th width="13%">IP</th>
<th width="13%">Hardware</th>
<th width="13%">OS</th>
<th width="24%">Roles</th>
<th width="24%">Recipes</th>
</tr>
Lastly a server count
role_count.rb:
A time stamp of the page generation
A html tabe giving the following for each node
<tr>
<th width="70%">Role</th>
<th width="30%">Count</th>
</tr>
Lastly a role count
= REQUIREMENTS:
Requires a webserver to server the html page from the output location.
= ATTRIBUTES:
The path of the web directory you want to server the report from:
default[:server_inventory][:output_dir] = /var/www/html
Output format can be html, csv, incase you want to import to another system:
default[:server_inventory][:output_format] = [ "html" ]
= USAGE:
Add the the run_list of any chef node and view pages via your brower. You may need to update the output_dir for your env.
I suggest a roll, but its not nessary
{
"name": "SERVER_INVENTORY_ROLE",
"default_attributes": {
},
"json_class": "Chef::Role",
"run_list": [
"recipe[server_inventory]",
"recipe[server_inventory::role_count]"
],
"description": "This role will be on one server that generates a up to date server list with every chef run",
"chef_type": "role",
"server_inventory": {
"output_dir": "/var/www/html/myvirtual.com",
"output_format": [
"html",
"csv"
]
}
}
}
This cookbook has no specified dependencies.
There are no cookbooks that are contingent upon this one.
No quality metric results found