Puppet Book

Puppet Book

#pfcasual

23f4d5d797a91b6d17d627b90b5a42d9?s=128

Kentaro Kuribayashi

May 10, 2013
Tweet

Transcript

  1. એ఻ ʰೖ໳Puppetʱ Automate Your Infrastructure

  2. @kentaro Software engineer Rubyist / Perl Monger Agile DevOps-er Kentaro

    Kuribayashi paperboy&co.
  3. ˒ લͷۈ຿ઌͰ͸Puppet΍ ChefΛ࢖͚ͬͯͨͲແࢹͬ ͯͨ ˒ ͍·ͷձࣾͰPuppetΛ࢖Θ ͟ΔΛಘͳ͘ͳͬͨͷͰ PuppetͱΘͨ͠

  4. ϒΫϩάͷύϒʔ http://p.booklog.jp/book/70667 ୡਓग़൛ձ http://tatsu-zine.com/books/puppet Amazon http://www.amazon.co.jp/dp/B00CL92JC0

  5. อଘ༻ ؍৆༻ ීٴ༻

  6. http://tmix.jp/design/detail/518356

  7. ೔ຊॳͷPuppetຊ

  8. ˒ ΦʔϓϯιʔεͳγεςϜࣗಈ؅ཧπʔϧ Puppet by mizzy ˒ Puppet Best Practice? by

    mizzy ˒ Puppetͷεεϝ by mizzy ˒ Puppet Dojo by @trombik ͜Ε·ͰͷPuppetʹؔ͢Δ೔ຊޠϦιʔε ͜Ε·Ͱ೔ຊޠॻ੶φγ
  9. None
  10. http://www.flickr.com/photos/bogdansuditu/2377844553/ ຊॻͷλʔήοτ૚

  11. ΦϖϨʔγϣϯΤϯδχΞΑΓ ΋Ή͠ΖΞϓϦέʔγϣϯ։ൃ ऀΛ૝ఆ ΞϓϦ։ൃऀ͕PuppetΛ࢖ͬͯγεςϜߏங ʹࢀՃͰ͖Δ͙Β͍·Ͱ

  12. lຊॻͷ໨ඪ͸ɺ͜ͷຊΛಡΜͩಡऀ͕Puppetͷ جຊʹ͍ͭͯͻͱͱ͓Γ஌ΓɺΦϖϨʔγϣϯΤ ϯδχΞͷॻ͍ͨmanifest αʔόͷ͋Δ΂͖ঢ় ଶΛهड़ͨ͠ઃఆϑΝΠϧͷΑ͏ͳ΋ͷɻޙड़ ʹ มߋΛՃ͑ͨΓɺ͋Δఔ౓ͷن໛ͷ΋ͷͳΒࣗྗ Ͱ͍͔ͪΒॻ͚ΔΑ͏ʹͳͬͨΓ͢Δ͜ͱͰ͢ɻ ͦͷͨΊɺຊॻ͸͋͑ͯϦϑΝϨϯεͱͯ͠ͷ໢ ཏੑΛ໨ࢦ͠·ͤΜɻ࣮ࡍͷֶशஈ֊Ͱඞཁͱͳ

    Δ஌ࣝʹ͠΅ͬͯઆ໌͠·͢ɻz ʮ͸͡ΊʹʯΑΓ
  13. ຊॻͷ಺༰

  14. جૅฤ 112ষ lHello, World!z͔Βɺͻͱͱ͓ΓͷϦιʔεΛ࢖͑ΔΑ͏ʹͳΔ·Ͱ Ԡ༻ฤ 13ষ td-agentΫϥελΛ࡞੒͠ɺserverspecͰςετɺσϓϩΠͱద༻·Ͱ

  15. ˒ VagrantΛ׆༻ͨ͠։ൃ؀ڥ ˒ ϋϯζΦϯͰֶ΂ΔΑ͏ߏ੒ ˒ ΄Μͱʹඞཁͳ͜ͱͷΈઆ໌ جૅฤͷϙΠϯτ

  16. ˒ class/moduleͳͲେن໛ͳ manifestΛॻ͘ͷʹ͔ܽͤͳ͍஌ ࣝʹ͍ͭͯղઆ ˒ ࣮ફతtd-agentΫϥελΛ࡞੒ ˒ serverspecʹΑΔςετʹ͍ͭͯ ˒ capistranoͰmanifestΛద༻

    Ԡ༻ฤͷϙΠϯτ
  17. Ԡ༻ฤͰߏங͢ΔγεςϜ

  18. None
  19. Learning Puppet͚ͩͰ͸ֶ΂ͳ͍ manifestߏ੒ͷϊ΢ϋ΢ʹ͍ͭͯղ આ͍ͯ͠Δͱ͜Ζ͕େ͖ͳҧ͍ɻ Leaning Puppet͸Α͍υΩϡϝϯτ ͕ͩɺݴޠཁૉҎ্ͷ͜ͱ͸ֶ΂ͳ͍

  20. ຊॻΛಡΉ͚ͩ Ͱجૅ͔Β࣮ફ ͰͷԠ༻త஌ࣝ ·ͰशಘՄೳɻ

  21. Infrastructure as Code

  22. ։ൃ Πϯϑϥ

  23. γεςϜঢ়ଶΛίʔυͰهड़ pull requestͰ૬ޓϨϏϡʔ ιʔγϟϧγεςϜߏங!!1 ܦݧతɺҰࢠ૬఻తɺൿ఻ͷλϨΛͰ͖Δ͚ͩ ͳ͘͢ɺίʔυԽ͞ΕͨγεςϜߏங

  24. None
  25. ΤϯδχΞ

  26. maglicaͳͲ ։ൃ؀ڥ https://github.com/mizzy/maglica AWS EC2ͳͲ ຊ൪؀ڥ http://aws.amazon.com/ Vagrant ϩʔΧϧ؀ڥ http://www.vagrantup.com/

  27. αʔό͕ίʔυͰ͍͡ ΕΔΑ͏ʹͳͬͨ͜ͷ Ϋϥ΢υ࣌୅Ͱ͸ʜʜ http://www.flickr.com/photos/nirak/644337888/

  28. ΤϯδχΞͷڞ௨ݴޠ ͱͯ͠ͷʮίʔυʯͷ ໾ׂ͸·͢·͢େ͖͍ http://www.flickr.com/photos/trinity-of-one/20562069/

  29. ϓϥοτϑΥʔϜ ݻ༗ͷख࡞ۀ Puppet/Chef ϓϥοτϑΥʔϜ ݻ༗ͷΞηϯϒϥ ߴڃݴޠ says...

  30. http://en.wikipedia.org/wiki/File:Boschsevendeadlysins.jpg ϓϩάϥϚͷࡾେඒಙ

  31. ແਫ਼(laziness) ୹ؾ(impatience) ၗຫ(hubris)

  32. ແਫ਼(laziness) ୹ؾ(impatience) ၗຫ(hubris)

  33. γεςϜߏஙʹ ʮແਫ਼ʯΛ࣋ͪࠐΉ

  34. ˒ खॱॻ࡞੒͕໘౗ ˒ खॱॻߋ৽͕໘౗ ˒ εΫϦϓτԽ͢Δͷ͕໘౗ ˒ εΫϦϓτΛอक͢Δͷ͕໘౗ ˒ ႈ౳ੑΛ୲อ͢Δͷ͕໘౗

    ˒ ͱʹ͔͘໘౗
  35. Ұݟ໘౗ͳPuppet ΍ Chef ΛֶͿͷ͸ʮ໘ ౗Λճආ͢ΔͨΊͳΒ ͍͘ΒͰ΋໘౗Λ͜ͳ ͢ʯͱ͍͏ʮແਫ਼ʯͷ ൃ࿐ʹଞͳΒͳ͍ɻ

  36. Chefͱͷൺֱ

  37. ݴޠ σΟϨΫτϦߏ੒ Puppet ֎෦DSL ൺֱతࣗ༝ Chef ಺෦DSL (Ruby) ෆࣗ༝

  38. package { 'zsh': ensure => installed } Puppet package 'zsh'

    do action :install end Chef
  39. ͍ͨͯ͠มΘΒͳ͍

  40. $ knife configure $ knife cookbook create hello -o cookbooks

    $ $EDITOR cookbooks/hello/recipes/default.rb $ $EDITOR localhost.json $ $EDITOR solo.rb $ chef-solo -c solo.rb -j localhost.json ChefͷHello, World! // localhost.json { "run_list" : [ "recipe[hello]" ] } # solo.rb file_cache_path "/tmp/chef-solo" cookbook_path ["/home/ec2-user/chef- repo/cookbooks"] # default.rb log “Hello, World!”
  41. $ $EDITOR hello.pp $ puppet apply hello.pp PuppetͷHello, World! #

    hello.pp notice(“Hello, World!”)
  42. େ͖ͳҧ͍

  43. Ͳͬͪʹ͠Ζ΍ΕΔ͜ͱ͸ಉ͡ Puppet͸ϑΝΠϧຕ͔Β࢝ ΊΒΕΔ ಋೖোน͕௿͍ ಠࣗDSLͷֶशίετͱ͍ͬͯ΋ɺRubyΛ஌Β ͳ͍ͻͱʹͱͬͯ͸Chefͩͬͯίετߴ

  44. ·ͱΊ

  45. ˒ ೔ຊॳͷPuppetʹؔ͢Δॻ੶ʰೖ ໳PuppetʱΛಡΉͱΫϥ΢υ࣌୅ ͷڞ௨ޠʮίʔυʯΛֶ΂Δ ˒ Puppet/Chef͸γεςϜߏஙʹ ʮଵଦʯΛ࣋ͪࠐΉ ˒ Puppet/ChefͲͬͪͰ΋͍͍͚Ͳ Έͳ͞Μ͕ࢥͬͯΔΑΓPuppet͸

    ؆୯Ͱ͢Ϥ
  46. ˒ ͲͬͪΛ࢖͏ʹͤΑɺ͘͢ͳ͘ͱ ΋͜ͷຊʹॻ͔Ε͍ͯΔ͜ͱʹͭ ͍ͯ͸஌্ͬͨͰɺબͼ·͠ΐ͏

  47. ϒΫϩάͷύϒʔ http://p.booklog.jp/book/70667 ୡਓग़൛ձ http://tatsu-zine.com/books/puppet Amazon http://tatsu-zine.com/books/puppet