Skip to content

Instantly share code, notes, and snippets.

@ShadySQL
Forked from thbar/knife.rb
Created June 26, 2016 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShadySQL/22725bef9af93e45b53244dd12027b36 to your computer and use it in GitHub Desktop.
Save ShadySQL/22725bef9af93e45b53244dd12027b36 to your computer and use it in GitHub Desktop.
Configuration files for chef-solo and knife, so they all use directories inside the chef repo, instead of default global pathes such as /etc, /var
After check out chef-repo and installed gem chef. The default pathes used by chef-solo and knife are in some global locations, such as /etc, /var. This gist demonstrats how to put all configuration files, data files and cache files just inside chef repo.
Put solo.rb in top directory of chef repo. Run chef-solo using option -c
chef-solo -c solo.rb
Put knife.rb into subdirectory .chef (create it if it is not there).
Generate a private key as .chef/sola.pem
log_level :info
log_location STDOUT
node_name 'solo'
client_key File.expand_path('../solo.pem', __FILE__)
cache_type 'BasicFile'
cache_options( :path => File.expand_path('../checksums', __FILE__))
cookbook_path [ File.expand_path('../../cookbooks', __FILE__) ]
You can generate this file using `ssh-keygen -f .chef/solo.pem`. It is really not used but must be here.
node_name 'solo'
file_cache_path File.expand_path('../cache', __FILE__)
file_backup_path File.expand_path('../backup', __FILE__)
cookbook_path File.expand_path('../cookbooks', __FILE__)
role_path File.expand_path('../roles', __FILE__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment