Skip to content

Instantly share code, notes, and snippets.

@aleskiontherun
Last active April 7, 2016 06:19
Show Gist options
  • Save aleskiontherun/6683c17417505d27d9bf94a001920d7d to your computer and use it in GitHub Desktop.
Save aleskiontherun/6683c17417505d27d9bf94a001920d7d to your computer and use it in GitHub Desktop.

Useful knife commands for a local Chef repo

Generate Chef secret

openssl rand -base64 512 | tr -d '\r\n' > /path/to/secret

Create encrypted data bag

export EDITOR=nano; knife data bag create BAG_NAME ITEM_NAME -z --secret-file /path/to/chef_secret

Will create ./data_bags/BAG_NAME/ITEM_NAME.json.

Edit encrypted data bag

export EDITOR=nano; knife data bag edit BAG_NAME ITEM_NAME -z --secret-file /path/to/chef_secret

Install or update a cookbook from the Supermarket

https://supermarket.chef.io/ https://docs.chef.io/knife_cookbook_site.html

knife cookbook site install COOKBOOK_NAME [COOKBOOK_VERSION] (options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment