Upgrade to Pro — share decks privately, control downloads, hide ads and more …

diff puppet chef

diff puppet chef

Talks at Taiwan Ruby Tuesday #23 with Ash Wu. Compare two popular DevOps tools puppet and chef.

Sheng-Je Lin

May 14, 2013
Tweet

More Decks by Sheng-Je Lin

Other Decks in Technology

Transcript

  1. diff puppet chef Ruby Tuesday #23

  2. Speakers Ash Wu Vincent about.me/hSATAC about.me/v1nc3ntlaw

  3. DevOps • DevOps => Bridge and oil between developers and

    operators. • Developer => Code • Operator => Infrastructure • Infrastructure as Code
  4. Infrastructure as Code • Automation • Configuration as document •

    Configuration as code • Better reuse • Versioning • Testing • Continuous Integration
  5. Puppet • Open source • Written in Ruby • Has

    its own DSL • You define the desired states (What does it look like) • Puppet will do the rest (How should it be done) • Used by Wikimedia, Rackspace, Zynga, Github, Google, Oracle...
  6. Masterless Puppet • Define • Simulate • Enforce • Report

  7. Master-Agent Puppet • Send facts • Compile • Query •

    Enforce • Report
  8. Resource • File • User • Group • Package •

    Service • Mount • Cron • ...... http://docs.puppetlabs.com/references/latest/type.html
  9. Dependencies • Code order != Execute order • Before /

    Require • Notify / Subscribe • Chaining Ex: Package -> File ~> Service • Autorequire • Puppet is smart enough so solve some dependencies for you. Ex: file and parent folder, user and ssh-key • Stage
  10. Puppet DSL • Variables, Conditions, Facts • Modules, Classes •

    Templates • Puppet > 2.6.x manifests can be written in Ruby https://puppetlabs.com/blog/ruby-dsl/
  11. Puppet Community • Modules, Classes • Puppet Forge http://forge.puppetlabs.com/ •

    Most of them are for debian/ubuntu/centos • `puppet module install puppetlabs-apache` install, list, search, uninstall, upgrade • Contribute please
  12. Enterprise Puppet • Not a service • Charges by node

    number (Free < 10 nodes) Node number detect from cert sign • Whole package installer • Web GUI • Support • https://puppetlabs.com/puppet/enterprise-vs-open- source/ • https://puppetlabs.com/puppet/whats-new/
  13. Puppet Testing • Syntax check - Puppet-lint http://puppet-lint.com/ • Unit

    test - rspec-puppet http://rspec-puppet.com/ • Multiple OS test - Puppet Playground https://github.com/example42/puppet-playground • Fizzgig - Fast puppet unit tests https://github.com/philandstuff/fizzgig
  14. Puppet Testing Articles • https://puppetlabs.com/blog/testing-puppet-code-in-the- puppet-playground/ • https://puppetlabs.com/blog/test-driven-development- with-puppet/ •

    http://puppetlabs.com/blog/verifying-puppet-checking- syntax-and-writing-automated-tests/
  15. Puppet File Server • Puppet masters built-in • `puppet://{server}/{mount}/{path}` •

    `puppet:///modules/test_module/testfile.txt` => /etc/puppet/modules/test_module/files/testfile.txt • Custom mount point allow /hostname/ allow cidr default deny * http://docs.puppetlabs.com/guides/file_serving.html
  16. Chef Intro • Opscode, Inc. • Just Enough Ruby for

    Chef ◦ http://docs.opscode.com/just_enough_ruby_for_chef.html • Chef 10 => 11 Server ◦ Released at 2013 Feb. Rewrite of the core API server in Erlang, which call Erchef. Migrated the WebUI from merb to Rails 3.
  17. http://docs.opscode.com/chef_overview.html

  18. Workstation • knife ◦ Command tool helps user manage Chef.

    • knife-ec2 ◦ Plugin extend knife subcommand ec2 manage AWS EC2 servers. • knife-github-cookbooks ◦ Plugin extend knife subcommand github download cookbooks from github repository. ◦ $ knife cookbook github install USER/REPO http://docs.opscode.com/knife.html
  19. Resource Resource • Package • User • Cron • Git

    • Script • Ruby • more... Provider • Chef::Provider::Package::Apt • Chef::Provider::Package::Yum package "tar" do Chef::Provider::Package::Yum action :install end http://docs.opscode.com/resource.html
  20. Cookbook Logic about install and configure packages. • Attributes •

    Files • Recipes • Templates
  21. Files • cookbook_file ◦ copying files from a cookbook •

    remote_file ◦ transferring files from remote locations
  22. Data Bags • Store data in a JSON file. user02.json

    ◦ { "id": "user02", "uid": "1002", "gid": "1002", "public_key": "ssh-rsa ABCDE..." } • Encrypt / Decrypt ◦ Store sensitive information
  23. Opscode Community http://community.opscode.com/ • Opscode maintains cookbooks • Community authored

    cookbooks • $ knife cookbook site install apache2
  24. Chef Server • Opscode Hosted Chef Server ◦ 5 Nodes

    Free • Install Chef Server ◦ Ubuntu (deb) ◦ Enterprise Linux (rpm) • AWS OpsWorks Richard Lee - Polydice, Inc. Does OpsWorks Work? ◦ https://speakerdeck.com/dlackty/does-opsworks-work
  25. Chef Solo • Run provision locally without Chef Server. •

    chef-solo is a limited-functionality version • chef-solo + capistrano ◦ https://github.com/doitian/chef-solo-repo http://docs.opscode.com/chef_solo.html
  26. Chef TEST • cucumber-chef • chefspec ◦ RSpec for chef

    cookbooks • foodcritic ◦ Lint tool • test-kitchen ◦ Framework for running integration tests in an isolated environment • minitest-chef-handler ◦ Run minitest after your Chef recipes to check the system status
  27. diff puppet chef Puppet Chef Coding Style DSL / Ruby

    DSL Ruby File Server Puppet File Server No Encrypted Data Bag No (*hiera-gpg) Yes Community Puppet Forge Opscode Community Dependencie s Yes No (Code Order) Commercial License / Per Node Hosted Service * http://www.craigdunn.org/2011/10/secret-variables-in-puppet-with-hiera-and-gpg/
  28. Vagrant • VirtualBox, VMware, AWS • Shell Scripts, Chef, or

    Puppet • ihower 2013 OSDC.TW A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩 ◦ http://www.slideshare.net/ihower/vagrant-osdc
  29. Other Resources • http://blog.hsatac.net • http://devops.tw (@devopstw)

  30. Q & A