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

入門Chef Solo落ち穂拾い

入門Chef Solo落ち穂拾い

Provisioning Frameworks Casual Talks vol.1 (https://gist.github.com/studio3104/5417631) での発表スライドです

B4afc7d853d7f1cb6a253d3c7183c05a?s=128

Naoya Ito

May 10, 2013
Tweet

Transcript

  1. ೖ໳$IFG4PMP མͪึर͍

  2. None
  3. None
  4. ຊ೔ͷ࿩୊

  5. •  ग़൛ޙͷ൓Ԡ͔Β •  མͪึर͍ 

  6. GBDFCPPLͱDIFG

  7. • $IFG$POG • GBDFCPPLͷதͷਓൃද IUUQULBLIBUFOBCMPHDPNFOUSZ

  8. •  QFPQMF •  5FOTPGUIPVTBOETPG IFUFSPHFOFPVTTZTUFNT •  0QTDPEF1SJWBUF$IFG •  l5FTUJOHBHBJOTUSFBMTZTUFNJT VTFGVMBOEOFDFTTBSZz

  9. $IFGͰͲ͜·Ͱ΍Δͷ 

  10. •  $IFGͰશ෦΍Δͷ  •  σϓϩΠ΋$IFGͰ  •  TTIͯ͠௚઀มߋ͸͢Δͷ 

  11. None
  12. •  جຊ͸$IFG͚ͩͰ΍Δ – Πϯελϯεىಈޙͷߏ੒มߋ͸શͯ $IFGͰߦ͏ɻ௚઀มߋ͠ͳ͍ •  ΞϓϦέʔγϣϯͷσϓϩΠ͸ྫ֎ – DBQJTUSBOPFUD

  13. •  େࣄͳߟ͑ํ – </(>$IFGࣗಈԽπʔϧ – <0,>$IFGϊʔυͷঢ়ଶ؅ཧ ccoonnvveerrggeennccee ((収束))

  14. •  ϊʔυͷঢ়ଶ͸$IFGͰهड़͞Ε͍ͯ ͳ͚Ε͹ͳΒͳ͍ – 㱺TTIͰߏ੒มߋ͢Δͱهड़͞Εͯͳ͍ ঢ়ଶ͕ଘࡏ͢Δ͜ͱʹ •  ΞϓϦέʔγϣϯσϓϩΠ͸ಛघ – SPMMCBDL΍ϒϧʔάϦʔ ϯσϓϩΠ – ͦΕઐ༻ͷπʔϧʹ೚ͤΔ

  15. $IFG4PMPͰͲ͜·Ͱ 

  16. •  $IFG4PMP͸ͲͷϨϕϧ·Ͱ  •  ෳ਺୆ʹ$IFG4PMP  •  $IFG4FSWFSWT$IFG4PMP

  17. •  େن໛ ਺ඦʙ ୆  – ͓ͦΒ͘$IFG4FSWFSҰ୒ •  தن໛ ʙ਺े୆ 

    – $IFG4PMPͰ΋ؤுΕΔ – $IFG4FSWFSೖΕΔ͔೰ΈͲ͜Ζ •  খن໛ ʙे਺୆  – $IFG4PMPͰे෼ 
  18. $  echo  host1  host2  host3  |  xargs  –n  1  knife

     solo  cook ਺୆ͳΒ͜ΕͰ
  19. $  cap  provision YBSHTͰਏ͘ͳͬͨΒŋŋŋ

  20. $  knife  search  node  “platform:centos  AND  languages_ruby_version: 1.8*” $IFG4FSWFS͸OPEFΛͰݕࡧͰ͖Δ

  21. $  sudo  chef-­‐client  –d  –i  900 $IFG4FSWFSͰ͸$MJFOU͕ࣗ཯ߋ৽Ͱ͖Δ

  22. •  $IFG4FSWFSͷಋೖ͕໘౗  – DIFG[FSPͬͯͷ͕ग़ͨͦ͏Ͱ͢ – %#΍ೝূ͕ͳ͍ͷͰӡ༻ָ͕ – ˞ະݕূ

  23. 'BCSJDWT$IFG

  24. None
  25. •  ൺֱ͕࣠ͣΕ͍ͯ·͕͢ŋŋŋ •  'BCSJD ͱTI $IFG͸ίϯηϓ τ͕େ͖͘ҟͳΔ

  26. •  ʲೋ౓໨ʳେࣄͳߟ͑ํ – </(>$IFGࣗಈԽπʔϧ – <0,>$IFGϊʔυͷঢ়ଶ؅ཧ ccoonnvveerrggeennccee ((収束))

  27. •  $IFG͸ঢ়ଶΛ؅ཧ͢Δ – ϨγϐͱҟͳΔঢ়ଶΛɺͦͷঢ়ଶʹͳ ΔΑ͏ʹ͢Δ •  ৔߹ʹΑͬͯ͸ʮ໭͢ʯ •  ʮαʔόʔߏஙࣗಈԽʯ͸ͦͷҰ໘ •  'BCSJD͸ঢ়ଶ͸؅ཧ͠ͳ͍

    – ॻ͔Εͨ௨Γʹʮલਐʯ͢Δ͚ͩ
  28. ϨγϐΛ(JUͰ؅ཧ͢Ε͹ʮϊʔυͷঢ়ଶʯΛόʔδϣϯ؅ཧ͢Δ͜ͱ͕Ͱ͖ Δɻ؅ཧ͍ͯ͠Δͷ͸୯ͳΔίʔυͰ͸ͳ͘ʮঢ়ଶʯɻ

  29. 7.Λڞ༗͢Δͷ  ϨγϐΛ഑Δͷ 

  30. •  ։ൃ؀ڥͷඪ४Խʹ$IFGΛ࢖͓͏ •  Ͱ͖͕͋ͬͨ7.ΠϝʔδΛڞ༗͢΂ ͖͔ɺϨγϐΛڞ༗͢΂͖͔ŋŋŋ 

  31. •  ϨγϐΛڞ༗͠Α͏ʂ – ࣗ෼ͰDPOWFSHFODFͯ͠΋Β͏ – ίʔυͰঢ়ଶΛ֎෦Խͨ͠ͷ͔ͩΒ – Ϩοπ4PDJBM$PEJOH

  32. ςετͲ͏͢Δͷ 

  33. None
  34. •  CFGPSFDPOWFSHFODFͳςετ •  *OUFHSBUJPOςετ

  35. •  CFGPSFDPOWFSHFODFͳςετ – LOJGFDPPLCPPLUFTU •  γϯλοΫενΣοΫͱ͔ – GPPEDSJUJD •  -*/5&3Έ͍ͨͳͷ – DIFGTQFD • 

    Ϣχοτ ςετ – TUSBJOFS •  Ҏ্ͷπʔϧͷ࣮ߦΛิॿ͢Δ΋ͷ
  36. require  'chefspec'     describe  'http_server::default'  do      let

     (:chef_run)  {  ChefSpec::ChefRunner.new.converge  'http_server::default'  }      it  'should  install  nginx'  do          chef_run.should  start_service  'nginx'      end        it  'should  start  nginx'  do          chef_run.should  start_service  'nginx'      end   end DIFGTQFD IUUQRJJUBDPNJUFNTGFEFFCDCGΑΓ 
  37. •  *OUFHSBUJPOςετ – NJOJUFTUDIFGIBOEMFS – TFSWFSTQFD – 5FTU,JUDIFO •  ෳ਺؀ڥΛ7BHSBOUͰ্ཱͪ͛ͯ NJOJUFTUͰςετ૸ΒͤͨΓ͢Δ

  38. require  'minitest/spec’     describe_recipe  'spec_examples::default'  do      describe

     "files"  do          it  "creates  the  config  file"  do              file("/etc/fstab").must_exist          end            it  "ensures  that  the  foobar  file  is  removed  if  present"  do              file("/etc/foobar").wont_exist          end      end   end NJOJUFTUDIFGIBOEMFS
  39. TFSWFSTQFD   ଞͷਓͷൃදݟͯͶ 

  40. •  ఆ൪͸UFTULJUDIFO NJOJUFTU –  PQTDPEFެࣜͩ͠ •  TFSWFSTQFDਪ͠ –  *OUFHSBUJPOςετ͸ॲཧܭʹґଘ͠ͳ͍ํ͕ྑ͍ • 

    কདྷԿ͔ʹ৐Γ׵͑Δ࣌΋ςετΛͦͷ··ྲྀ༻Ͱ͖Δ –  UFTULJUDIFO TFSWFSTQFDྑͦ͞͏ɻͨͩ͠ະݕূ •  ೰·͍͠ͱ͜Ζ – DIFGTQFD *OUFHSBUJPO5FTU͸݁ߏ৑௕ŋŋŋ ಉ͡Α͏ͳهड़͕ଟ͍
  41. •  $IFG੝Γ্͕ͬͯΔ – GBDFCPPL͕਺ສ୆ͱ͔ܹ͍͠ •  ࢖͏ͳΒ$IFGͷίϯηϓτʹै͓͏ – ʮϊʔυͷঢ়ଶʯΛ؅ཧ͠Α͏ •  TFSWFSTQFDਪ͠ɻଞ΋ީิ͋ΔΑ