Puppet & Chef

Puppet & Chef

新卒研修でやった座学の内容。
既に Puppet & serverspec で研修を進めていたので、まとめと周辺知識の関連付け。

D7df6557c6b98f29ac546911e2b1a4d4?s=128

Shinya Tsunematsu

June 21, 2013
Tweet

Transcript

  1. 2013/06/21 @tnmt Puppet ΍ Chef ͷجૅ ͳΜͰඞཁͳͷͱ͔

  2. ຊ೔ͷΞδΣϯμ ✤ Puppet, Chefͱ͸ ✤ Puppet, Chefͷඞཁੑ ✤ Puppet, Chefͷߏ੒

    ✤ ΠϯϑϥͷίʔυԽͱͦͷपล஌ࣝ
  3. Puppet, Chefͱ͸

  4. Puppet, Chef ✤ Provisioning Framework < Configuration Management Framework

  5. Configuration Management ✤ ߏ੒؅ཧͷλεΫྫ ✤ ωοτϫʔΫઃఆ ✤ Ϣʔβ࡞੒ɾ؅ཧ ✤ ιϑτ΢ΣΞΠϯετʔϧઃఆ

    ✤ ͜ΕΒΛ”͋Δ΂͖ঢ়ଶ”ʹҡ࣋͢Δ͜ͱ͕ߏ੒؅ཧ ✤ ͦΕΛ࣮ݱ͢ΔͨΊͷπʔϧ͕Puppet, Chef
  6. Puppet, Chefͷඞཁੑ

  7. ৄ͘͠͸ ✤ mizzy͞ΜͷPuppet࿈ࡌॳճ http://gihyo.jp/admin/serial/01/ puppet/0001 ΍ ✤ antipop͞Μͷ”ೖ໳Puppet”ୈ1ষ ʮͳͥPuppet͕ඞཁͳͷ͔ʁʯ ✤

    Λࢀߟʹ…͍ͬͯ͏ͱ͋ΕͳͷͰ࣮ࡍಡΈ߹Θͤ
  8. ߏ੒؅ཧλεΫͷ࣮ݱํ๏ʢ̍ʣ ✤ खॱॻʹΑΔखಈઃఆ ✤ ख࡞ۀʹΑΔ࣌ؒͷϩε ✤ ΦϖϨʔγϣϯϛεͷՄೳੑ ✤ खॱॻͷߋ৽๨Εɺܗ֚Խɺ੔߹ੑҡ͕࣋೉͍͠

  9. ߏ੒؅ཧλεΫͷ࣮ݱํ๏ʢ̎ʣ ✤ εΫϦϓτʹΑΔࣗಈԽ ✤ εΫϦϓτͷ඼࣭ҡ͕࣋ݸਓͷεΩϧʹΑΔ ✤ ߏ੒มߋ΁ͷ௥ै͕೉͍͠ʢޙड़͢Δႈ౳ੑʣ

  10. ͜͜Ͱ ✤ खॱॻ͕ͻͲ͍ͱ͜ΖΛݟͤΔʢٽ͖ͳ͕Βʣ

  11. Chef, Puppetେࣄɾخ͍͜͠ͱ ✤ ႈ౳ੑ ✤ ίʔυ඼࣭ͷۉҰԽ ✤ ίϥϘϨʔγϣϯՄೳ

  12. ႈ౳ੑ ✤ Կ౓࣮ߦͯ͠΋ಉ͡ঢ়ଶʹͳΔ͜ͱ ✤ ৽نɾطଘʹରͯ͠ͷૢ࡞Ͱ΋ಉ͡

  13. ίʔυ඼࣭ͷۉҰԽ ✤ େମ୭͕ॻ͍ͯ΋ࣅͨΑ͏ͳײ͡ʹͳΔ ✤ ݚमͰ࡞ͬͯΔ manifest ݟͯ΋ͦ͏ͩΑͶʁ ✤ ଞͷਓ͕ॻ͍ͯΔͷΛݟΕ͹େମԿ΍ͬͯΔ͔෼͔Δ ✤

    ී௨ʹ࢖͍ͬͯΕ͹ݸਓͷεΩϧʹ͋Μ·Γࠨӈ͞Εͳ͍ ✤ ෳࡶͳه๏ॻ͖࢝ΊΔͱ·ͨผ͚ͩͲ…
  14. ίϥϘϨʔγϣϯՄೳ ✤ ΤϯδχΞಉ࢜Ͱ૬ޓʹվળ͕Մೳ ✤ Opsಉ࢜Ͱ΋ɻDev͕ॻ͍͍͍ͨͬͯ (DevOps) ✤ VCSΛ༻͍ͨվળ (Pull Request,

    ϨϏϡʔ) ✤ ௥੻Մೳͱ͍͏ϝϦοτ
  15. Puppet, Chefͷߏ੒

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

    ܾ·͍ͬͯΔ
  17. ͱ͸͍͑ ✤ ઌ΄Ͳͷ͸֤ϓϩμΫτͷ࢓༷తͳͱ͜ΖͷൺֱͰ ✤ ʢೖ໳ Puppet ʹ΋هࡌͯ͋͠Δʣ ✤ ࣮ࡍʹఏڙ͞ΕΔػೳͱͯ͠͸େ͖ࠩ͘͸ͳ͍ ✤

    Ҏ߱͸ڞ௨͍ͯ͠Δӡ༻ʢ࢖͍ํʣͷઆ໌
  18. Master, Agentܕ ✤ Puppetͷmanifest, Chefͷrecipe Λूத؅ཧ͢ΔϚελʔɺద༻͢Δ ΤʔδΣϯτͷܗΛऔΔ͜ͱ͕ग़དྷΔ ✤ طଘͷϖύϘ঎ࡐ͸͜ͷߏ੒Λऔ͍ͬͯΔͱ͜Ζ͕ଟ͍ ✤

    node৘ใͷ؅ཧ͕ඞཁ ✤ PuppetͩͱςΩετʢ࣮ྫʣɺLDAPͳͲऔΕΔ ✤ ‘puppet agent’ ‘chef-client’
  19. Puppetͷྫ

  20. ୯ମͰ࣮ߦ ✤ manifest, recipe Λద༻͢Δαʔόʹ഑ஔͯ͠୯ମͰ࣮ߦ͢Δ ✤ Master, AgentܕΑΓ͓खܰ ✤ ‘puppet

    apply’, ‘chef-solo’ ✤ ࠷ۙ͸ͪ͜Β͕ਓؾग़͖ͯͯΔʢޙड़ʣ
  21. ΠϯϑϥͷίʔυԽ

  22. ίϥϘϨʔγϣϯՄೳͱॻ͍ͨ ✤ Manifest, Cookbooks Λόʔδϣϯ؅ཧग़དྷͯɺෳ਺ਓͰ؅ཧ ✤ ϨϏϡʔͨ͠Γվળͨ͠Γग़དྷΔ ✤ ͜Εͬͯී௨ʹϓϩάϥϜͱҰॹ

  23. ϓϩάϥϜͱҰॹ ✤ ͜ΜͳྲྀΕ͕ग़དྷΔΑ͏ʹͳΔ ✤ खݩͷvagrantͰmanifest΍recipeΛ࡞੒ͯ͠ (development) ✤ ࣾ಺ͷmaglica؀ڥͳͲͰ֬ೝͯ͠ (integration) ✤

    ࣮ࡍͷαʔϏεͷεςʔδϯάͰ֬ೝͯ͠ (staging) ✤ ຊ൪ʹ౤ೖ (production)
  24. ϓϩάϥϜͱҰॹ ✤ ͜͏͍͏ͱ͖͸୯ମ࣮ߦ͕ศརͩͶ ✤ ֤؀ڥʹpupper-server΍chef-serverΛߏங͢Δͷ͸͠ΜͲ͍ ✤ ͔͠΋ͦΕΒ͸ӡ༻ʹͦΕͳΓʹख͕͔͔ؒΔ

  25. Vagrant ✤ ‘vagrant provision’ ίϚϯυ ✤ http://docs-v1.vagrantup.com/v1/docs/provisioners.html ✤ ࡞ͬͯյͯ͠ͱ͍͏ͷ͕؆୯ʹग़དྷΔ

  26. ࠓ·ͰͷδϨϯϚ ✤ manifest΍recipeͷ֬ೝ͕େม ✤ ࡞੒ ✤ ద༻ ✤ ֬ೝ ʢ໨ࢹʣ

  27. ໘౗ͳ͜ͱ͸CI ✤ ͜͜࠷ۙ೤͍τϐοΫ ✤ ϓϩάϥϚϒϧʹαʔόߏங͕ग़དྷΔΑ͏ʹͳͬͨ ✤ ֬ೝ΍ςετΛCIͰճͤΔΑͱ͍͏ͷͰઌਓ͕ϊ΢ϋ΢ΛஷΊͯڞ༗ ͖͍ͯͯ͠Δ

  28. ႈ౳ੑສࡀ ✤ طଘͷαʔό΁ͷద༻ ✤ ৽نαʔόͷߏங ✤ ͲͪΒʹͰ΋࢖͑ΔɺͲͪΒ΋֬ೝग़དྷΔ

  29. CIྫ (Puppet) ✤ “Ukigumo ͱ serverspec Ͱ Puppet ͷܧଓతΠϯςάϨʔγϣϯ” ✤

    http://mizzy.org/blog/2013/03/27/2/ ✤ puppet-lxc-box Ͱ࡞ͬͨίϯςφʹରͯ͠ܧଓతʹ puppet apply ͠ ͯ݁ՌΛϨϙʔτ
  30. CIྫ (Chef) ✤ “Vagrant + Chef Solo + serverspec +

    Jenkins ͰαʔόʔߏஙΛ CI” ✤ http://d.hatena.ne.jp/naoya/20130520/1369054828 ✤ vagrant ʹΑͬͯ࡞੒ͨ͠ vm ʹରͯ͠ɺ৽ن࡞੒→knife-soloద༻ →serverscpec→ഁغ ͱ͍͏ྲྀΕ
  31. ઌ΄ͲͷCIͷλΠτϧΛݟ௚͢ ✤ “Ukigumo ͱ serverspec Ͱ Puppet ͷܧଓతΠϯςάϨʔγϣϯ” ✤ “Vagrant

    + Chef Solo + serverspec + Jenkins ͰαʔόʔߏஙΛ CI”
  32. serverspecʹ͍ͭͯ͸ ✤ ࠓ೔ͷ hbstudy#45 Ͱʂʂ̍

  33. ͓·͚ʣ΋͏̍ͭͷςετ ✤ αʔϏε؂ࢹ (ϞχλϦϯά͡Όͳͯ͘ࢮ׆؂ࢹͳͲ) ✤ ϖύϘͰ͸NagiosΛ࢖͍ͬͯΔ ✤ NagiosपΓ͸ࠇా͞Μ͕ࠓ౓࿩ͯ͘͠Ε·͢ ✤ serverspec͕ϗϫΠτϘοΫεςετͳΒ,

    αʔϏε؂ࢹ͸ϒϥοΫϘ οΫεςετ ✤ ʢ௥هʣ࣮ࡍӡ༻தͷNagiosը໘ΛݟͯΈͨ