[ヒカラボ][AWS構成管理]Terraformで実装できることをAnsible AWSモジュールでどこまでできるか? / ansible-as-terraform

12a5cec7a54018170b1a009731acf477?s=47 VTRyo
October 04, 2017

[ヒカラボ][AWS構成管理]Terraformで実装できることをAnsible AWSモジュールでどこまでできるか? / ansible-as-terraform

12a5cec7a54018170b1a009731acf477?s=128

VTRyo

October 04, 2017
Tweet

Transcript

  1. <"84ߏ੒؅ཧ> 5FSSBGPSNͰ࣮૷Ͱ͖Δ͜ͱΛ "OTJCMF"84ϞδϡʔϧͰͲ͜·ͰͰ͖Δ͔ *OGSB43&ɹ3:0 

  2. ΞδΣϯμ ɾࣗݾ঺հ ɾͳͥίʔυԽΛ࠾༻ͨ͠ͷ͔ ɾࠓճ΍ͬͯΈͨ͜ͱ ɹɹ71$ TFDVSJUZHSPVQ &$ߏஙΛ"OTJCMFͰ΍ͬͯΈΔ ɹɹΠϯελϯελΠϓมߋ ɹɹ&#4༰ྔΛ૿΍͢ ɾ5FSSBGPSNͱ"OTJCMFͷࠩҟ

    ɹͦΕͧΕͷϑΝΠϧ؅ཧํ๏ ɾ·ͱΊ
  3. ࣗݾ঺հ ϓϩϑΝΠϧ ɾ౦ژ౎ҏ౾େౡग़਎ ɾ๭ࢲେ৺ཧֶՊࣾձ৺ཧֶઐ߈ ɾ4*ۀք4&4ΠϯϑϥΤϯδχΞͱͯ͠ΩϟϦΞελʔτ ɾݱࡏ͸8&#ܥاۀͷΠϯϑϥΤϯδχΞ ɾٕज़ϒϩάझຯͷൃ৴ ʢIUUQTCMPHWUSZPNFʣ

  4. ฐࣾͷओͳٕज़ˍकඋൣғ ඒӢ͜ͷ͸ ʢ$7্ࡔ͢ΈΕʣ

  5. ͳͥίʔυԽΛ࠾༻ͨ͠ͷ͔

  6. ͳͥίʔυԽΛ࠾༻ͨ͠ͷ͔ ɾखॱ͕ਓʹΑͬͯҟͳΔ ɾΠϯϑϥߏ੒Λ஌͍ͬͯΔͷ͕ߏஙͨ͠ਓ͚ͩ ɾଟ਺ͷΠϯϑϥߏஙґཔʹ๲Ε্͕Δ޻਺ ίʔυԽʹΑͬͯߏ੒Λશһ͕೺Ѳʂ ݸਓϓϨʔ΍ɺΠϯϑϥߏஙʹ͔͔Δ࣌ؒ΋ݮͬͨʂ

  7. ͳͥίʔυԽΛ࠾༻ͨ͠ͷ͔ ͳͥ5FSSBGPSN࠾༻ͨ͠ͷ͔ ɾαϙʔτ͍ͯ͠ΔαʔϏε͕ଟذʹΘͨΔ ɾ։ൃεϐʔυ͕଎͘ɺ΍͍ͬͯͯૉ௚ʹָ͍͠ʢ͜Εେࣄʣ ͳͥ"OTJCMF࠾༻ͨ͠ͷ͔ ɾΤʔδΣϯτϨεʹΑΔಋೖίετͷ௿͞ ɾίʔυΛॻ͍ͨ͜ͱ͕ͳ͍৽ਓͰ΋ॻ͚Δ

  8. ˞5FSSBGPSNͳΒ ࠓޙϦιʔε͕૿͑ͯ΋໰୊ͳ͍

  9. ࠓ೔ͷௌߨऀλʔήοτ ɾ"OTJCMFͷجૅΛ஌͍ͬͯΔͻͱ ɾ5FSSBGPSNͷجૅΛ஌͍ͬͯΔͻͱ ͜Ε͔Βษڧ͢Δํ΁ɻΩʔϫʔυ͸ͪ͜Βʢখ੠ʣ 4QFBLFS%FDL"OTJCMFʹΑΔΠϯϑϥࣗಈԽೖ໳ IUUQTTQFBLFSEFDLDPNWUSZPBOTJCMFOJZPSVJOIVSB[JEPOHIVBSVNFOɹ 4QFBLFS%FDL5FSSBGPSNೖ໳ IUUQTTQFBLFSEFDLDPNWUSZPUFSSBGPSNSVNFO

  10. ͍Α͍Αຊ୊ ࠓճ΍ͬͯΈͨ͜ͱʹ͍ͭͯͰ͢ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  11. (JUIVCɿIUUQTHPPHM:C%7;ɹ ࠓճ΍ͬͯΈͨ͜ͱ ݟ͍ͯͭ͘ͷϙΠϯτ ɾ5FSSBGPSNͰͷ࣮૷ͱಉఔ౓ͷ࠶ݱ͸Մೳ͔ ɾ5FSSBGPSNͱ"OTJCMFͷ࢖͍উखͷΑ͞͸ͲͪΒ͔

  12. ࠓճ΍ͬͯΈͨ͜ͱ ͦ΋ͦ΋5FSSBGPSNͱ"OTJCMF͸ಘҙ෼໺͕ҧ͏͕ɾɾɾ 5FSSBGPSNͰ࣮૷Ͱ͖Δ͜ͱΛ"OTJCMF"84ϞδϡʔϧͰͲ͜·ͰͰ͖Δ͔ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  13. ࠓճ΍ͬͯΈͨ͜ͱ "OTJCMFͰఏڙ͞Ε͍ͯΔ"84.PEVMFͰ 5FSSBGPSN͘Β͍ͷ͜ͱ͕Ͱ͖ΔͩΖʂʁ ͱ͍͏࿩ ͜Εͧ"OTJCMFѪ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  14. ࣮ߦ؀ڥ͸ʁ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  15. ࠓճ΍ͬͯΈͨ͜ͱ ᶃϩʔΧϧϚγϯʢBOTJCMFQMBZCPPLʣˠᶄ࡞ۀϚγϯʹ44)͞ΕΔɹɹ ɹˠᶅ&$౿Έ୆ͷCPUP͕"84ϞδϡʔϧΛѻͬͯCVJME͢Δ ʢ4(ͷ࡞੒ͷΈCPUPͷΠϯετʔϧ͕ඞཁͳͷͰ஫ҙʣ (JUIVCɿIUUQTHPPHM:C%7;ɹ ᶃ ᶄ ᶅ

  16. 5FSSBGPSNͱͷൺֱݕূ։࢝ʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  17. ࣮ࢪ಺༰ 43&͋ͩͪΜϒϩάʹ͋ΔUFSSBGPSNͷهࣄΛݩʹ ɾ71$ ɾ4FDVSJUZ(SPVQ ɾ&$ ͷߏஙΛ"OTJCMFͰ࣮ࢪʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ ؆୯Ͱ͢Ͷʂ

  18. ࣮ࢪ಺༰ ͋ͩͪΜͷهࣄҰཡ ɾ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ΈͨΒૉ੖Β͔ͬͨ͠ IUUQTCMPHBEBDIJONFXPSEQSFTTBSDIJWFT ɾ<"84><5FSSBGPSN>W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒͞Ε ͳ͘ͳͬͯͨͥʂ IUUQTCMPHBEBDIJONFXPSEQSFTTBSDIJWFT ɾ<"84><5FSSBGPSN>&#4ͰσΟεΫ૿΍͢ͱΠϯελϯε࠶࡞੒͞Ε͔ͨ Βྫྷ΍׼Ϟϊ IUUQTCMPHBEBDIJONFXPSEQSFTTBSDIJWFTɹ

    (JUIVCɿIUUQTHPPHM:C%7;ɹ
  19. <"84><5FSSBGPSN>&$ͱ71$Λ ࣗಈԽͯ͠ΈͨΒૉ੖Β͔ͬͨ͠ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  20. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ ֓ཁ 5FSSBGPSNΛ͔ͭͬͯҎԼΛߏங ɾ&$ ɾ71$ 4VCOFU 3PVUF5BCMF *OUFSOFU(BUFXBZ ɾ4FDVSJUZ(SPVQ

    (JUIVCɿIUUQTHPPHM:C%7;ɹ
  21. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ ιʔείʔυ͸ ͋ͩͪΜͷαΠτ͔ (JUIVCͰ͆ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  22. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ "OTJCMFͰݕূϙΠϯτ ɾ*%औಘܥͷϞδϡʔϧΛ ɹ࢖༻͢Δ͜ͱ ɾॲཧ݁ՌΛม਺Խ͢Δ͜ͱ ɾEFCVHϞδϡʔϧͰ֨ೲͨ͠஋Λ ɹՄࢹԽͤ͞Δ͜ͱ ɾႈ౳ੑ͸DPVOU@UBHͱFYBDU@DPVOU ɹͰΧόʔ

    (JUIVCɿIUUQTHPPHM:C%7;ɹ
  23. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ "OTJCMFͰݕূϙΠϯτ ɾ*%औಘܥͷϞδϡʔϧΛ ɹ࢖༻͢Δ͜ͱ ɾॲཧ݁ՌΛม਺Խ͢Δ͜ͱ ɾEFCVHϞδϡʔϧͰ֨ೲͨ͠஋Λ ɹՄࢹԽͤ͞Δ͜ͱ ɾႈ౳ੑ͸DPVOU@UBHͱFYBDU@DPVOU ɹͰΧόʔ

    (JUIVCɿIUUQTHPPHM:C%7;ɹ
  24. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  25. ႈ౳ੑ΋໰୊ͳ͍ ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  26. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ ໰୊ͳ͘Ͱ͖ͯΔʂʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  27. ʰ<"84><5FSSBGPSN>&$ͱ71$ΛࣗಈԽͯ͠ ΈͨΒૉ੖Β͔ͬͨ͠ʱ ײ૝ ɾ"OTJCMFͰ͸࡞੒ͨ͠Ϧιʔεͷ*%Λऔಘ͢ΔͷʹϞδϡʔϧΛ࢖͏ ඞཁ͕͋ΔͨΊɺͻͱखؒ૿͑Δ ɾEFCVHϞδϡʔϧΛ࢖͑͹+40/ͷϓϩύςΟ͕ॻ͖΍͍͢ ɾ্ه̎ͭΛຖճ΍ΔͷͰQMBZCPPL͕௕͍ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  28. <"84><5FSSBGPSN>W͔ΒΠ ϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  29. ʰ<"84><5FSSBGPSN> W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂʱ ֓ཁ ΠϯελϯελΠϓΛมߋͯ͠΋طଘΠϯελϯ ε͕ফ͑ͨΓ͠ͳ͍ ͋ͩͪΜϒϩάɹUTNBMMˠUNJDSP 3:0ɹUNJDSPˠUTNBMM (JUIVCɿIUUQTHPPHM:C%7;ɹ

  30. ʰ<"84><5FSSBGPSN> W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂʱ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  31. ʰ<"84><5FSSBGPSN> W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂʱ QMBZCPPL ɾ&$ىಈͱಉ͡ZNM ɾJOTUBODF@UZQF͚ͩ ɹมߋ͓ͯ͘͠ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  32. ʰ<"84><5FSSBGPSN> W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂʱ ݕূ݁ՌɹࠨଆͷQMBZCPPLͰ͸มߋ͕͔͔Βͣ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  33. ʰ<"84><5FSSBGPSN> W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂʱ ݕূ݁Ռ ৽͍͠Πϯελϯε͕࡞੒͞Εͯ͠·ͬͨ &$͕՝ۚ͞Εͨ໛༷ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  34. ʰ<"84><5FSSBGPSN> W͔ΒΠϯελϯελΠϓมߋͯ͠΋࠶࡞੒ ͞Εͳ͘ͳͬͯͨͥʂʱ ײ૝ ɾγϯϓϧʹ՝ۚ͞ΕΔͷͭΒ͍ ɾTUPQTUBSUͰΠϯελϯελΠϓ͕มߋ͞Ε ΔUFSSBGPSNͷརศੑʹ͸ٴ͹ͳ͍ʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  35. <"84><5FSSBGPSN>&#4ͰσΟε Ϋ૿΍͢ͱΠϯελϯε࠶࡞੒͞Ε ͔ͨΒྫྷ΍׼Ϟϊ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  36. ʰ<"84><5FSSBGPSN>&#4ͰσΟεΫ૿΍͢ͱ Πϯελϯε࠶࡞੒͞Ε͔ͨΒྫྷ΍׼Ϟϊʱ ֓ཁ ʮUFSSBGPSNͰ&#4Λมߋ͢ΔͱΠϯελϯε ͕ফ͑ͯ࠶࡞੒͞ΕΔʯ &#4(J#ˠ(J# (JUIVCɿIUUQTHPPHM:C%7;ɹ

  37. ʰ<"84><5FSSBGPSN>&#4ͰσΟεΫ૿΍͢ͱ Πϯελϯε࠶࡞੒͞Ε͔ͨΒྫྷ΍׼Ϟϊʱ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  38. ʰ<"84><5FSSBGPSN>&#4ͰσΟεΫ૿΍͢ͱ Πϯελϯε࠶࡞੒͞Ε͔ͨΒྫྷ΍׼Ϟϊʱ QMBZCPPL ɾWPMVNF@TJ[FΛ ɹมߋ͓ͯ͘͠ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  39. ʰ<"84><5FSSBGPSN>&#4ͰσΟεΫ૿΍͢ͱ Πϯελϯε࠶࡞੒͞Ε͔ͨΒྫྷ΍׼Ϟϊʱ ݕূ݁Ռ ΍ͬͺΓ৽͍͠Πϯελϯε͕࡞੒͞ΕΔ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  40. ʰ<"84><5FSSBGPSN>&#4ͰσΟεΫ૿΍͢ͱ Πϯελϯε࠶࡞੒͞Ε͔ͨΒྫྷ΍׼Ϟϊʱ ײ૝ ͚Ͳ"OTJCMFͳΒΠϯελϯε͸ফ͑ͨΓ͠ͳ͍ ҆৺҆શͷ"OTJCMFɻ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  41. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ͔͜͜Β͸ݕূͨ݁͠ՌΛ΋ͱʹ ࢲ͕޷͖উखʹπʔϧΛධՁ͢Δ͓࣌ؒͰ͢ʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  42. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ݸਓతͳπʔϧͷײ૝ɹ˒̑ͭධՁ (JUIVCɿIUUQTHPPHM:C%7;ɹ ˞"84ͷΦʔέετϨʔγϣϯʹݶΔ

  43. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ίʔυԽ͠΍͢͞ ʲ5FSSBGPSNʳ˒˒˒˒ ɾUFSSBGPSNJNQPSUػೳ͕͋ΓෳࡶͳϦιʔε΋ࡹ͚Δ ɾಈతʹ*%Λऔಘ͢Δͷ͕༰қ ɾ+40/׳Εͯ͠Δਓʹ͸༗ར ʲ"OTJCMFʳ˒ ɾ"84Ϟδϡʔϧૢ࡞ͷ೉қ౓͕ߴΊ ɾJNQPSU͢Δػೳ͸ͳ͍ ɾ"OTJCMF׳Ε͍ͯ͠Δਓʹ͸༗རʢZBNMࣗମ͸ॻ͖΍͍͢ʣ

    (JUIVCɿIUUQTHPPHM:C%7;ɹ
  44. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ֶशίετͷ௿͞ ʲ5FSSBGPSNʳ˒˒˒ ɾυΩϡϝϯτ΍8&#ʹ͋ΔهࣄΛಡΊ͹͋Δఔ౓ॻ͚Δ ɾόʔδϣϯΞοϓσʔτͷεϐʔυ͕଎͘ͲΜͲΜ৽ػೳ͕࣮૷͞Ε Δ ʲ"OTJCMFʳ˒ ɾ"OTJCMFʹݶΕ͹ߴ͘ͳ͍͕ɺ"84Ϟδϡʔϧͷ࢖༻೉қ౓͕ߴΊ ɾ͋·Γ΍͍ͬͯΔਓ͕͍ͳ͍ͨΊʹ৘ใ͕গͳ͍ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  45. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ҆શੑͷߴ͞ ʲ5FSSBGPSNʳ˒˒ ɾϦιʔε࠶࡞੒ͷةݥੑʢ஌Βͳ͍ͱେมͳ͜ͱʹͳΔʣ ɾόʔδϣϯΞοϓσʔτͰվળ͞Ε͍ͯΔʢΠϯελϯελΠϓมߋ ͳͲʣ ʲ"OTJCMFʳ˒˒˒˒ ɾݕূதɺطଘͷϦιʔε͕࡟আ͞ΕΔڍಈ͸ͳ͔ͬͨ ɾखҧ͍Ͱ৽نΠϯελϯε্ཱ͕͕ͪͬͨ৔߹͸՝ۚ͞Εͯ͠·͏ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  46. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ႈ౳ੑ ʲ5FSSBGPSNʳ˒˒˒˒ ɾUFSSBGPSNUGTUBUFͱUGϑΝΠϧʹࠩ෼͕ͳ͚Ε͹໰୊ͳ͍͕ɾɾɾ ɾ(JUIVCͰݖݶ͕ফࣦͨ͠ͱ͍͏ࣄྫ΋͋ͬͨΓͱ·ͩ·ͩݕূ͕ඞཁ ʲ"OTJCMFʳ˒˒˒˒ ɾDPVOU@UBH FYBDU@DPVOUͷ࢖༻ͰΠϯελϯεͷႈ౳ੑ໰୊ͳ͠ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  47. 5FSSBGPSNͱ"OTJCMFͷࠩҟ ͪͳΈʹɾɾɾ ϑΝΠϧ؅ཧํ๏ʹ΋ҧ͍͕͋ΔͷͰؾΛ͚ͭΔ ʲ5FSSBGPSNʳ UFSSBGPSNUGTUBUFϑΝΠϧˠ4ਪ঑ ʲ"OTJCMFʳ (JU؅ཧͰ΋໰୊ͳ͍ʢ˞ΫϨσϯγϟϧ͸؅ཧ͠ͳ͍ʣ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  48. ·ͱΊ "OTJCMF"84ϞδϡʔϧͰͲ͜·ͰͰ͖Δ͔ ɾ5FSSBGPSNͱಉ࣮͡૷͕Մೳ ɾʮطଘϦιʔε͕࡟আ͞ΕΔʯͱ͍͏5FSSBGPSNಛ༗ͷة ݥੑ͸ͳ͍ ɾ1MBZCPPL͕5FSSBGPSNΑΓ௕͍ʢ·ΘΓ͘Ͳ͍ҹ৅ʣ ɾ"OTJCMF"84Ϟδϡʔϧͷֶशίετ͸ߴΊ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  49. ·ͱΊ 5FSSBGPSNͱ"OTJCMFɺͲ͕͍͍ͬͪͷ͔ ɾ"OTJCMF޷͖ͱͯ͠͸΋ͪΖΜ࢖͍͍͕ͨɺ޻਺͸࣮֬ʹ 5FSSBGPSNͷ΄͏͕গͳ͍ɻ ɾΠϯϑϥ౔୆ߏங͸5FSSBGPSNʹ܉഑ɻൺֱ͢Δͱ؆୯͕͞ ͋Δ ɾΠϯϑϥ͸5FSSBGPSNɺϛυϧ͸"OTJCMFɻ͜Ε͕࠷΋޾ͤ ʹͳΕͦ͏ɻ ॅΈ෼͚ɺେࣄʂ (JUIVCɿIUUQTHPPHM:C%7;ɹ

  50. ൪֎ฤ "OTJCMFͰ"84ϞδϡʔϧΛୟ͘ͱ %SZ3VO͕4LJQ͞ΕΔɾɾɾ ɾ@ɾ  (JUIVCɿIUUQTHPPHM:C%7;ɹ

  51. ݄೔ʢ໦ʣd ࠷ڧര଎8&#αʔό)0௒ೖ໳ ։࠵༧ఆ ʢ$PNQBTTʹܝࡌ͞Ε·͢ʣ ৔ॴɿौ୩ ొஃऀɿ3:0 ʲࠂ஌ʳ

  52. <"84ߏ੒؅ཧ> 5FSSBGPSNͰ࣮૷Ͱ͖Δ͜ͱΛ "OTJCMF"84ϞδϡʔϧͰͲ͜·ͰͰ͖Δ͔ ׬