• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Install and run chef solo real quick

Install and run chef solo real quick



My notes on installing and running chef-solo.

My notes on installing and running chef-solo.
- Install chef-solo
- Create a simple cookbook/recipe and run it



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds


Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.


11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Thanks, this was useful. Had to do couple of minor changes ...

    1. The knife command to create ntp gave warning 'No config file' and did not create ntp recipe. I fixed it by 'mkdir chef-repo/cookbooks/ntp' and rerunning knife

    2. Per flow, the web.json is not in chef-repo directory, it is in parent of chef-repo directory. So the chef-solo command should be 'chef-solo -c chef-repo/solo.rb -j ./web.json'
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Install and run chef solo real quick Install and run chef solo real quick Document Transcript

    • Install and run chef-solo in minutes benjaminrtz@gmail.com Install chef ============ curl -L https://www.opscode.com/chef/install.sh | bash Check ===== # chef-solo -v Chef: 11.6.2 Setup chef repository ===================== #wget http://github.com/opscode/chef-repo/tarball/master #tar zxvf master opscode-chef-repo-f9d4b0c/ opscode-chef-repo-f9d4b0c/.gitignore opscode-chef-repo-f9d4b0c/LICENSE opscode-chef-repo-f9d4b0c/README.md opscode-chef-repo-f9d4b0c/Rakefile opscode-chef-repo-f9d4b0c/certificates/ opscode-chef-repo-f9d4b0c/certificates/README.md opscode-chef-repo-f9d4b0c/chefignore opscode-chef-repo-f9d4b0c/config/ opscode-chef-repo-f9d4b0c/config/rake.rb opscode-chef-repo-f9d4b0c/cookbooks/ opscode-chef-repo-f9d4b0c/cookbooks/README.md opscode-chef-repo-f9d4b0c/data_bags/ opscode-chef-repo-f9d4b0c/data_bags/README.md opscode-chef-repo-f9d4b0c/environments/ opscode-chef-repo-f9d4b0c/environments/README.md opscode-chef-repo-f9d4b0c/roles/ opscode-chef-repo-f9d4b0c/roles/README.md #mv opscode-chef-repo-f9d4b0c/ chef-repo # ls chef-repo/ certificates config chefignore cookbooks data_bags environments LICENSE Rakefile README.md roles Notice the directory structure created in the chef repository? Create .chef directory inside chef-repo ======================================= # mkdir chef-repo/.chef Setup a local cookbook path ===========================
    • # vi chef-repo/.chef/knife.rb cookbook_path [ '/root/chef-repo/cookbooks' ] Create your first cookbook ========================== # knife cookbook create ntp ** Creating cookbook ntp ** Creating README for cookbook: ntp ** Creating CHANGELOG for cookbook: ntp ** Creating metadata for cookbook: ntp Here's the cookbook =================== # ls chef-repo/cookbooks/ntp/ attributes definitions libraries templates CHANGELOG.md files metadata.rb providers recipes README.md resources Writing your first recipe ========================= # vi chef-repo/cookbooks/ntp/recipes/default.rb package 'ntp' This will install ntp if it is not installed. If it is already installed, it will do nothing. Now configure your server using chef-solo ========================================= # vi chef-repo/solo.rb file_cache_path "/root/chef-solo" cookbook_path "/root/chef-repo/cookbooks" # vi web.json { "run_list": [ "recipe[ntp]" ] } Ensure ntp is not installed =========================== # yum remove -y ntp Use chef-solo to configure your server ===================================== # chef-solo -c chef-repo/solo.rb -j chef-repo/web.json Starting Chef Client, version 11.6.2 Compiling Cookbooks... Converging 1 resources
    • Recipe: ntp::default * package[ntp] action install - install version 4.2.4p8-3.el6.centos of package ntp Chef Client finished, 1 resources updated Confirm ntp is installed ======================== # yum info ntp Notes ====== Uninstall chef #yum remove -y chef Other ways to install chef # wget https://www.opscode.com/chef/install.sh # bash install.sh or Go http://www.opscode.com/chef/install/ and select your distro, distro version and architecture. Download the package. In my case, I use CentOS: # wget https://opscode-omnibuspackages.s3.amazonaws.com/el/6/x86_64/chef-11.6.2-1.el6.x86_64.rpm # yum localinstall -y chef-11.6.2-1.el6.x86_64.rpm Another to setup your chef repo # git clone git://github.com/opscode/chef-repo.git # ls chef-repo/ certificates chefignore config cookbooks data_bags LICENSE Rakefile README.md roles environments References 1. http://gettingstartedwithchef.com/first-steps-with-chef.html 2. https://learnchef.opscode.com/starter-use-cases/ntp/