Your SlideShare is downloading. ×
0
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Stanford Hackathon - Puppet Modules

2,122

Published on

A quick intro to hacking on Puppet modules from Nan Liu and Dan Bode.

A quick intro to hacking on Puppet modules from Nan Liu and Dan Bode.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,122
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
80
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Stanford Hackathon (D|N)an - Business Development(d|n)an@puppetlabs.com | #puppet PuppetLabs - 2012
    • 2. Overview
    • 3. Overview
    • 4. Puppet vs. Scripts• Abstraction• Idempotent• Declarative
    • 5. Abstraction• Puppet packages: package { ‘sshd’: ensure => ‘present’, }• Packages commands: yum/rpm apt/deb pkgadd/pkgutil gem ...
    • 6. Idempotent• Script: service sshd stop Stopping sshd: [ OK ] service sshd stop Stopping sshd: [FAILED]• Puppet: puppet resource service sshd ensure=stopped ... notice: /Service[sshd]/ensure: ensure changed running to stopped puppet resource service sshd ensure=stopped ...
    • 7. Declarative Puppet internal Puppet user System state (is): Desire state (should):service sshd status service { sshd: ensure => running, } system == desire No noop? No Remedy (sync): Reportservice sshd start
    • 8. Puppet Resource• Puppet manifest building block • file • user • package • service • ...
    • 9. Puppet Resource• puppet resource <type> [title]
    • 10. Puppet Manifests• package { ‘ssh’: ensure => ‘present’, } file { ‘/etc/sshd/sshd_config’: owner => ‘root’, group => ‘root’, mode => ‘0600’, source => ‘puppet:///modules/sshd/sshd_config’, require => Package[‘ssh’], } service { ‘sshd’: ensure => ‘running’, subscribe => File[‘/etc/sshd/ssd_config’], }
    • 11. Puppet Organization manifests package { sshd:node lisa { ensure => latest, class {lisa { { } node "ssh": class ssh { }} class {lisa node "ssh": } class ssh { … } class { "ssh": } } … } } file { sshd_config: source => "puppet:///..." site.pp } files native resource (ruby) # sshd_config,v 1.81 # # sshd_config,v 1.81 This is the sshd server # This is the sshd server system-wide configuration system-wide configuration ssh::root_key { … key => "AAAA…" … } ssh module define resource (puppet)
    • 12. Module Directories• manifests: puppet manifests (*.pp)• files: configuration file• templates: ERB template (*.erb)• lib: ruby (*.rb)• tests: puppet unit testing (*.pp)
    • 13. Organization
    • 14. Module Development• Syntax Check• Unit Test• Acceptance Test• Environment -> Deploy
    • 15. Puppet Syntax• puppet parser validate • git commit hook • vim syntastic • geppetto (eclipse IDE)• puppet best practice • puppet-lint
    • 16. Unit Test• puppet cucumber• rspec-puppet (Tim Sharpe)
    • 17. rspec-puppet• verify resources in catalog• validate different facts• validate different parameters
    • 18. rspec-puppet• rspec-puppet directory structure:• <module_name>/spec /classes /defines /fixtures /manifests/site.pp
    • 19. rspec-puppet• #rspec_test/manifests/init.pp class rspec_test($message = ‘default’) { notify { $message: } }• #rspec_test/spec/rspec_test_spec.rb describe rspec_test do describe with default parameters do it { should contain_notify(default) } end describe when overriding message do let :params do {:message => override} end it { should contain_notify(override) } end end
    • 20. Travis CI• Github integration• Invoke test on git push• Simple test matrix
    • 21. .travis.yml• language: ruby before_script: - git clone git://github.com/puppetlabs/puppetlabs- stdlib.git spec/fixtures/modules/stdlib rvm: - 1.8.7 - 1.9.2 script: "rake spec" env: - PUPPET_VERSION=2.6.12 - PUPPET_VERSION=2.7.12 matrix: exclude: - rvm: 1.9.2 env: PUPPET_VERSION=2.6.12
    • 22. Gemfile• source :rubygems puppetversion = ENV.key?(PUPPET_VERSION) ? "= #{ENV[PUPPET_VERSION]}" : [>= 2.7] gem puppet, puppetversion  group :test do gem rake, >= 0.9.0 gem rspec, >= 2.8.0 gem rspec-puppet, >= 0.1.1 end
    • 23. Travis CI
    • 24. Acceptance Testing• vagrant box • veewee (basebox) • http://vagrantbox.es• vagrant init• vagrant up• vagrant provision
    • 25. Vagrant• config.vm.provision :puppet do |puppet| puppet.manifests_path = "manifests" puppet.manifest_file = "oneiric.pp" end• config.vm.network :hostonly, "10.0.2.15"• config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
    • 26. Puppet Modules• forge.puppetlabs.com• www.github.com/puppetlabs• Bring your own module!
    • 27. Module Projects?• Module cleanup • puppet-lint (best practice)• Module test • rspec puppet • travis ci• Module development
    • 28. Puppet Projects?• Puppet issues: projects.puppetlabs.com• Puppettools: geppeto puppet-lint rspec-puppet
    • 29. We are hiring!
    • 30. We are hiring!

    ×