!SLIDE
!SLIDE left
- Chef-Solo runs on the local machine and requires dependencies to be on that machine
- Chef has a server and nodes
- the server contains dependencies and instructions
- the node communicates with the server to configure itself
I don't know much about Chef-Solo.
!SLIDE left
- stores data needed for the chef run (more on this later)
- has a web UI
- indexes data about nodes for searching
- pay OpsWorks to provide the Chef server
- support
- build your own server
- no support, but also no boundaries
!SLIDE left
Basically two components: the Chef Repo and Cookbooks
- analogous to a rails app; it's the driver of your infrastructure
- knife gem for operating on the chef server
- cucumber-chef gem for BDD
- analogous to a gem, but more integral
- contains the code necessary to accomplish some specific goal (e.g. install monit, or update the apt-cache)
!SLIDE left
- Init the chef-repo
- Set up the chef server
- Connect your chef repository to the server
- Make your first cookbook
- TDD it using ChefSpec
- Use it in your chef-repo
- Gems like Librarian-Chef and Berkshelf (both are like Bundler) are useful for managing cookbooks
- BDD it using Cucumber-Chef
- Runs code against an actual server (EC2 or Vagrant)
!SLIDE left
- Run it on a node
- Use Knife-EC2 to launch nodes
- Run the chef-client. Two options:
- ssh onto the target machine
chef-repo $ knife node show NODE_NAME
chef-repo $ ssh user@ip
chef-node $ chef-client
- use
knife ssh
bundle exec knife ssh 'name:NODE_NAME' 'chef-client'
- useful switches:
-i /path/to/chef.pem
-x root
run as root user (default is ubuntu)
- useful switches:
- ssh onto the target machine
!SLIDE left
- chef-repo/
- config/
- rake.rb
- cookbooks/
- data_bags/
- environments/
- roles/
- Rakefile
- chefignore
- README.md
- config/
!SLIDE left
My additions:
- chef-repo/
- ...
- features/
- step_definitions/
- support/
- environments/
- test.rb
- env.rb
- environments/
- lib/
- tasks/
- Cheffile
- Cheffile.lock
- Gemfile
- Gemfile.lock
!SLIDE left
- my_cookbook/
- attributes/
- default.rb
- definitions/
- files/
- default/
- libraries/
- providers/
- recipes/
- default.rb
- resources/
- templates/
- metadata.rb
- README.md
- attributes/
!SLIDE left
My additions:
- my_cookbook/
- ...
- spec/
- spec_helper.rb
- default_spec.rb
- Cheffile
- Cheffile.lock
- Gemfile
- Gemfile.lock