Skip to content

Instantly share code, notes, and snippets.

@ksauzz
Last active December 13, 2015 23:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksauzz/4993628 to your computer and use it in GitHub Desktop.
Save ksauzz/4993628 to your computer and use it in GitHub Desktop.
chef notes....

Chef note

using local chef-repo.

setup

git clone git://github.com/opscode/chef-repo.git
cd chef-repo
rm -rfv .git
git init && git add . && git commit -m

install cookbook

from opscode server.

knife cookbook search cookbook-name
knife cookbook site install cookbook-name

from github

using knife-github-cookbooks

gem install knife-github-cookbooks

knife cookbook github install owner/repo-name
knife cookbook github install owner/repo-name -S    # private repository

environment

knife cookbook upload hoge --freeze -E production

backup.

there are 2 methods to backup chef-server's data.

backup data is in ./.chef directory.

knife-hacks

cd /usr/local/src
git clone git://github.com/stevendanna/knife-hacks.git
mkdir -p ~/.chef/plugins/knife
ln -s /usr/local/src/knife-hacks/plugins/backup_*.rb ~/.chef/plugins/knife/

knife backup export --backup-directory backup

chef_server_backup script

curl -O https://raw.github.com/jtimberman/knife-scripts/master/chef_server_backup.rb
knife exec chef_server_backup.rb

misc

download roles from chef-server

 cd local-chef-repo
 for role in `knife role list`;do knife role show $role --format json > roles/$role.json; done

installing chef-client

knife bootstrap IP or FQDN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment