Infrastructure as Code

Infrastructure as Code

B4afc7d853d7f1cb6a253d3c7183c05a?s=128

Naoya Ito

July 07, 2016
Tweet

Transcript

  1. *OGSBTUSVDUVSFBT$PEF /BPZB*UP גࣜձࣾҰٳ$50 

  2. ΞδΣϯμ •  *OGSBTUSVDUVSFBT$PEF͕ੈͷதʹग़͖ͯͯ •  ͲΜͳࢥߟɾࢼߦաఔ͕͋ͬͯ •  ࠓͲ͏͍͏ঢ়گʹࢸ͍ͬͯΔͷ͔

  3. •  $'&OHJOF •  1VQQFU •  $IFG •  "OTJCMF

  4. •  $'&OHJOF •  1VQQFU •  $IFG •  "84౦ژϦʔδϣϯ •  "OTJCMF

    •  ʰೖ໳$IFG4PMPʱग़൛
  5. ೖ໳$IFG4PMPग़൛౰࣌ •  ࠃ಺Ͱ΋਺ඦ୆ن໛ͷαʔόʔΛ࣋ͭҰ෦8FCاۀ͕1VQQFU$IFG •  ʮ*OGSBTUSVDVUVSFBT$PEFʯ͸·ͩ·ͩ •  *BB4ͷར༻͕ຊ֨Խ͠ɺαʔόʔ͕ΑΓಈతͳ΋ͷʹ

  6. ౰࣌ͷ*OGSBTUSVDUVSFBT$PEF΁ͷظ଴஋ •  Ϋϥ΢υʹͳͬͯΑ͘࡞Γ௚͢͠ɺߏஙΛࣗಈԽ͍ͨ͠ •  ൿ఻ͷλϨԽ͢Δαʔόʔઃఆۀ຿ΛͲ͏ʹ͔͍ͨ͠

  7. None
  8. ؾ͕͍ͭͨ͜ͱ •  ίʔυʹͳͬͨ͠ɺόʔδϣϯ؅ཧ͢Ε͹͍͍ •  (JUΛ࢖͏ͳΒ(JU)VC

  9. Πϯϑϥ΋1VMM3FRVFTU͢Δ

  10. ίʔυʹͯ͠ΈͨΒ෼͔ͬͨ •  ΞϓϦέʔγϣϯ։ൃͰഓ͖ͬͯͨϓϥΫςΟεΛΠϯϑϥʹ΋Ԡ༻Ͱ͖ ΔͷͰ͸ •  (JU(JU)VCΛओ࣠ʹͨ͠ܧଓతσϦόϦʔ

  11. ςετ΋ॻ͚Δ 4FSWFSTQFD  require 'spec_helper' describe package('httpd'), :if => os[:family]

    == 'redhat' do it { should be_installed } end describe service('httpd'), :if => os[:family] == 'redhat' do it { should be_enabled } it { should be_running } end describe port(80) do it { should be_listening } end
  12. $*΋Ͱ͖Δ

  13. NBTUFSʹϚʔδͨ͠ΒσϓϩΠɺ΋Ͱ͖Δ 『インフラの継続的デリバリー』 h#p://d.hatena.ne.jp/naoya/20140821/1408577976

  14. *OGSBTUSVDUVSFBT$PEFͷ࠶ൃݟ •  ࣗಈԽ΍ίʔυԽ͕ୡ੒͍ͨ͠໨తͰ͸ͳ͔ͬͨ –  ͦΕ͸$POpHVSBUJPOBT$PEFΒ͍͠ •  5IPVHIU8PSLTTBZT5IJTJTOPUTJNQMZXSJUJOHTDSJQUT CVUJOWPMWFT VTJOHUFTUFEBOEQSPWFOTPGUXBSFEFWFMPQNFOUQSBDUJDFTUIBUBSF BMSFBEZCFJOHVTFEJOBQQMJDBUJPOEFWFMPQNFOU

    IUUQTXXXUIPVHIUXPSLTDPNJOTJHIUTCMPHJOGSBTUSVDUVSFDPEFSFBTPOTNJMF
  15. 'PXMFSઌੜͷϓϥΫςΟε •  6TF%FpOJUJPO'JMFT •  4FMGEPDVNFOUFETZTUFNTBOEQSPDFTTFT •  7FSTJPOBMMUIFUIJOHT •  $POUJOVPVTMZUFTUTZTUFNTBOEQSPDFTTFT • 

    4NBMMDIBOHFTSBUIFSUIBOCBUDIFT •  ,FFQTFSWJDFTBWBJMBCMFDPOUJOVPVTMZ h#p://mar;nfowler.com/bliki/InfrastructureAsCode.html
  16. Ϋϥ΢υͱ*OGSBTUSVDUVSFBT$PEF •  Ϋϥ΢υ࣌୅ʹͳͬͯΠϯϑϥ͕ಈతʹͳͬͨ –  ʮΠϯϑϥετϥΫνϟʯ͕ιϑτ΢ΣΞʹΑͬͯந৅Խ͞Εͨ •  ಈతͳΠϯϑϥΛίϯτϩʔϧ͢Δͷʹɺ*OGSBTUSVDUVSFBT$PEFͷϓϥ ΫςΟε͸૬ੑͷྑ͍ղͩͬͨ

  17. ͜ͷύλʔϯ͕Ԡ༻Ͱ͖Δͷ͸αʔόʔ͚ͩͳͷ͔  •  ࣅͨΑ͏ͳύλʔϯ͕αʔόʔҎ֎ʹ΋ݟͯऔΕΔ •  XJOFCBSSFMSPBEXPSLFS –  "843PVUFͷઃఆΛએݴతͳ3VCZ%4-Ͱఆٛద༻Ͱ͖Δπʔϧ •  %/4ઃఆΛܧଓతσϦόϦʔ

    –  %/4Ϩίʔυͷ3VCZ%4-Λ(JU)VCͰ؅ཧ –  1VMM3FRVFTUܖػʹςετ ESZSVO Λ࣮ߦ –  NBTUFSʹϚʔδͨ͠Β3PVUFʹ൓ө͢Δ
  18. %/4ઃఆΛ(JU)VCͰ؅ཧ͠

  19. 1VMM3FRVFTUͯ͠$*ϨϏϡʔ

  20. NBTUFSʹϚʔδ͢Δͱ%/4൓ө

  21. ͜Εԡ͢ɻҎ্ มߋ൓өΛ(JU)VCͷϚʔδϘλϯʹू໿

  22. Ͳ͏ͨ͠ΒՄೳʹ ŋŋŋ3FQSPEVDJCMF#VJME •  3FQSPEVDJCMF#VJME Ϗϧυͷ࠶ݱՄೳੑ ॏཁ –  ίʔυԽɺࣗಈԽŋŋŋΑΓ΋3FQSPEVDJCMF͔Ͳ͏͔ –  खॱͰ͸ͳ͋͘Δ΂͖ঢ়ଶΛهड़

    એݴత ɻ࣮ߦ݁Ռ͸ႈ౳ •  3FQSPEVDJCMFͳΒϏϧυͯ͠ςετͯ͠σϓϩΠ͕Մೳʹ •  ͦΕΛୡ੒͢ΔͨΊͷํ๏͕$POpHVSBUJPOBT$PEFͰ͋Γɺએݴతͳ $POpHVSBUJPONBOBHFNFOUUPPM –  %PDLFSͦͷ΄͔΋ಉ͡ߟ͑ํ –  ΞϓϦέʔγϣϯ։ൃͷੈքͰ͸5IF5XFMFWF'BDUPS"QQʹ͋ΔϓϥΫςΟε
  23. 3FQSPEVDJCMF#VJME •  $POpHVSBUJPO.BOBHFNFOU5PPM 1VQQFU $IFG "OTJCMF  –  αʔόʔߏ੒Λ3FQSPEVDJCMFʹ • 

    SPBEXBMLFS –  %/4ઃఆΛ3FQSPEVDJCMFʹ •  5FSSBGPSN –  "84.BOBHFNFOU$POTPMF্ͰͷϙνϙνۀΛ3FQSPEVDJCMFʹ •  %PDLFS$PNQPTF –  %PDLFSίϯςφؒͷґଘؔ܎Λ3FQSPEVDJCMFʹ
  24. ŋŋŋͱ͍͏Θ͚Ͱ •  ʮ*OGSBTUSVDUVSFBT$PEF͸ιϑτ΢ΣΞ։ൃͷϓϥΫςΟεΛΠϯϑϥ ʹ΋ద༻͢ΔΜͩʯ •  ͱ͍͏จ຺Ͱ޿·ͬͯɺΘΓͱड͚ೖΕΒΕ͍ͯΔͷ͕ݱঢ়

  25. Ͱ΋ɺͦΕͰྑ͔ͬͨͷ͔  •  ίʔυʹ͢Δͷ͸खॱԽͷͨΊ͚ͩ͸ͳ͍ˠಉҙ •  ιϑτ΢ΣΞ։ൃͷϓϥΫςΟεΛʙˠಉҙ •  Ϋϥ΢υ࣌୅ͷΠϯϑϥ؅ཧʹద͍ͯ͠Δˠಉҙ •  Ҏ্Ͱ͢ˠ͑ͬ

  26. •  ʮߏஙखॱΛίʔυԽʯ͢ΔΜ͡Όͳ͍ •  ΠϯϑϥετϥΫνϟΛϞσϦϯά͢ΔΜͩ –  ͜Ε͕*OGSBTUSVDUVSFBT$PEFͷຊջͩͱࢥ͍ͬͯͨ

  27. ෳࡶੑʹཱͪ޲͔͏ʹ͸ŋŋŋ •  ιϑτ΢ΣΞ։ൃͷෳࡶੑʹର͢Δ࠷΋ॏཁͳϓϥΫςΟε͸ϞσϦϯάͰ͸ͳ͍ ͷ͔  •  ۀ຿Λͦͷ··γεςϜʹམͱ͢ͷͰ͸ͳ͘ɺϞσϦϯά͢Δ͜ͱͰॳΊͯγες ϜΛۀ຿ʹઓུతʹ׆͔ͤΔͷͰ͸ͳ͔ͬͨͷ͔  • 

    ͦͷ*OGSBTUSVDUVSFBT$PEFɺ೥ޙɺෛ࠴ʹͳͬͯͳ͍ 
  28. "OTJCMFWT$IFGͱ͔ŋŋŋ •  Ͳ͏Ͱ΋͍͍ •  ʮΤʔδΣϯτΛΠϯετʔϧ͠ͳͯ͘΋͍͍ ŝžŕʯ –  ͦΜͳ΋ͷೖΕΕ͹͍͍͚ͩͩΖ௕೥ϝϯςͯ͘͠ͷʹΠϯετʔϧ෼ͷख͕ؒল͚ ͔ͨΒͬͯԿ͕خ͍͠Μͩ • 

    ͲͪΒ͕ʮΑΓ༏ΕͨϞσϦϯάΛఏҊ͢Δʯ΋ͷͳͷ͔ •  ͲͪΒ͕ΑΓɺݱγεςϜͷϞσϦϯάཁٻਫ४ʹద͍ͯ͠Δͷ͔
  29. ʮΠϯϑϥͷϞσϦϯάʯٞ࿦͕੝ΜʹͳΔ͔  •  ŋŋŋͳΒͳͦ͏ •  ࣮ફதͷΤϯδχΞͷظ଴஋͸ͦ͜ʹͳͦ͞͏ •  Ή͠ΖίϯςφͦͷଞͰίʔυͰ؅ཧ͢΂͖ର৅ΛͳΔ΂͘ݮΒ͢ର৅ Λখ͘͢͞Δ͜ͱͰෛ࠴ԽΛආ͚Δ܏޲ 

    –  ʮ%PDLFSpMFͰ͍͍΍ʯΈ͍ͨͳػӡ –  ڊେͳ$IFGDPPLCPPLϨϙδτϦͱ͔୭΋ݟͨ͘ͳͦ͞͏ –  *OGSBTUSVDUVSFBT$PEFͷϓϥΫςΟεͷ࣮ફྖҬ͸૿΍ͭͭ͠ɺίʔυԽର৅͸෼ׂ౷ ࣏ 
  30. ·ͱΊ •  ͋Δ΂͖࢟Λίʔυʹ͢ΔɺࣗಈԽ͢Δ͚ͩͰ͸ͳ͍ •  ຊ࣭͸ιϑτ΢ΣΞ։ൃͷϓϥΫςΟεͷద༻ɺΒ͍͠ •  3FQSPEVDJCMF#VJMEॏཁ •  ʮϞσϦϯάʯ΁ͷظ଴஋͸͋·Γߴ͘ͳΒͳ͔ͬͨ • 

    ΑΓখ͘͞෼ׂ͠ɺΑΓ؅ཧ͠ͳ͍ํ޲ʹΉ͔ͬͯ͘ŋŋŋͷ͔΋
  31. ΤϯδχΞืूத