Skip to content

Instantly share code, notes, and snippets.

@djk29a
djk29a / export-chef-roles.sh
Last active October 9, 2015 15:48
Download Chef roles in all environments to JSON files
mkdir environments
for env in $(knife environment list); do
knife environment show "${env}" --format=json > "environments/${env}.json"
done
@djk29a
djk29a / bookshelf-du.rb
Last active October 9, 2015 15:47
[Chef] Get Bookshelf Usage by-org
# Retrieve the size of Chef cookbooks used by different organizations on the Chef server it runs on
# Should run as root normally since we use su to hop across to another user
full_org_list=''
full_file_list=''
orgs={}
# Getting orgs can take a while, let's hold onto the results for repeat invocations
if not File.exist?('.orgs-cached')
# NOTE: this produces 2 header lines and a footer line that has the rowcount