simple chef-zero setup

Developer from somewhere

Simple Chef-Zero setup

  • create folder
    1
    
    my-chef
  • 1
    
    cd my-chef
  • 1
    
    mkdir .chef
  • 1
    
    ssh-keygen -f local.pem -P ""
  • 1
    
    ssh-keygen -f validation.pem -P ""
  • add this to knife.rb:
current_folder = File.dirname(__FILE__)

chef_repo      = File.join(current_folder, "..")
chef_server_url  "http://127.0.0.1:9901"
node_name        "local"
client_key        File.join(current_folder, "local.pem")

cookbook_path    "#{chef_repo}/cookbooks"
cache_type       "BasicFile"
cache_options    :path => "#{chef_repo}/checksums"
  • make sure to start chef-zero on port 9901:
chef-zero --port 9901
  • make a folder
    1
    
    nodes
    at the same level as .chef
  • add some data in
    1
    
    nodes/lenode.json
{
  "name": "lenode",
  "chef_type": "node",
  "json_class": "Chef::Node",
  "chef_environment": "_default",
  "run_list": [
    "recipe[whatever]",
  ],
  ...
}
  • cd to same level as nodes folder
  • upload them:
knife upload nodes