Slide 1

Slide 1 text

"OTJCMFͱ 5FSSBGPSNͱ ࣗݾ঺հ (JU)VCTBOUBL w ฏ੒͸શظؒࣾձਓ w ΄΅ιϑτ΢ΣΞ։ൃ w ͷखश͍Ͱ"OTJCMF Ansible Night in Tokyo 2019.07

Slide 2

Slide 2 text

࿩͢͜ͱ 5FSSBGPSNͬͯ *B$πʔϧͷҐஔ෇͚੔ཧ ࣮ࡍɺ࢖͍෼͚Λ͢Δʁ ݁࿦ !2

Slide 3

Slide 3 text

5FSSBGPSNͬͯԿʁ એݴతϞσϧϕʔεͷ*B$πʔϧ )FBU $MPVE'PSNBUJPOͱಉྨ ͨͩ͠ϚϧνΫϥ΢υ΁ͷରԠՄೳ %3:36/Մೳ ߏஙޙͷΠϯϑϥঢ়ଶϑΝΠϧ͕ ϙΠϯτ )BTIJ$PSQ͕։ൃɺ044&OUFSQSJTF൛΋͋Γ !3

Slide 4

Slide 4 text

5FSSBGPSNͬͯ ਓؾ্ঢதʁ !4 Ansible Chef Terraform Google Trend https://azure.microsoft.com/ja-jp/solutions/devops/terraform/ https://jp.alibabacloud.com/solutions/devops/terraform 5FSSBGPSNιϦϡʔγϣϯ IUUQTHJUIVCDPN(PPHMF$MPVE1MBUGPSNUFSSBGPSNFS طଘͷ؀ڥ͔Β5FSSBGPSN༻ͷఆٛϑΝΠϧ Λੜ੒͢Δπʔϧʢ($1͕։ൃʣ https://blog.pulumi.com/using-terraform-remote-state-with-pulumi 1VMVNJͰ5FSSBGPSNTUBUFϑΝΠϧ ΛಡΈࠐΈͰ͖ΔΑ

Slide 5

Slide 5 text

*B$πʔϧͷҐஔ෇͚੔ཧ !5 ωοτϫʔΫج൫ Ծ૝Խج൫ ίϯςφج൫ ΦϯϓϨϛε ύϒϦοΫΫϥ΢υ "[VSF ($1 "84 LT 0QFO4UBDL 7.8BSF 0QFO4IJGU /495 Heat μΠφϛοΫΠϯϑϥετϥΫνϟϓϥοτϑΥʔϜ ΠϯϑϥετϥΫνϟఆٛπʔϧ CloudFormation Terraform αʔόʔߏ੒πʔϧ Ansible ੔ཧ࣠ͷҾ༻ݩ "[VSF4UBDL (,&0OQSFN "840VUQPTUT Πϯϑϥج൫ӡ༻ऀ ۀ຿޲͚ Πϯϑϥ؅ཧऀ ۀ຿։ൃऀ AP Πϯϑϥج൫ఏڙଆ Πϯϑϥج൫ར༻ଆ ʮҐஔ෇͚ʯͷ੔ཧͰ͋ΓػೳతͳΦʔό ϥοϓ͸͋Δɺͱهࡌ͞Ε͍ͯ·͢ɻ

Slide 6

Slide 6 text

5FSSBGPSNͱ"OTJCMFΛ Ұॹʹ࢖͏ʁ !6 https://www.redhat.com/ja/resources/hashicorp-terraform-ansible-infrastructure-as-code-overview TERRAFORM INVOKING ANSIBLE AUTOMATION ANSIBLE AUTOMATION INVOKING TERRAFORM ͜ͷࢿྉʹ͸ҎԼͷ̎ྫ͕Ͱ͖Δͱهࡌ͞Ε͍ͯΔ HCL (HashiCorp Configuration Language) Playbook Playbook Ansible Module HCL ʢݸਓͷײ૝Ͱ͢ʣ πʔϧΛࠞͥͯ࢖Θͳ͍ํ͕ྑ͍ͷͰ͸ʁ ࠨهͷ̎ྫͷར఺͕Θ͔Βͳ͍ɻɻ τϥϒϧγϡʔςΟϯά͕େมͦ͏ɻ ʮͰ͖Δʯͱॻ͍ͯ͋Δ͕ɻɻɻ ͜ͷΑ͏ʹ૊Έ߹ΘͤΔཧ༝΍ Ձ஋ʹ͍ͭͯઆ໌͕ͳ͘ࠔ࿭ ʢ͜ͷࢿྉ͕ࠓճͷ-5ͷ ΩοΧέʹʣ

Slide 7

Slide 7 text

!7 ͪΐͬͱ͚ͩৄ͘͠ݟͯΈΔͱɻɻ ϝϯςφϯε؍఺͔Β TERRAFORM INVOKING ANSIBLE AUTOMATION ANSIBLE AUTOMATION INVOKING TERRAFORM hcl resource “aws_instance” “web” { # ... provisioner “local-exec” { command = “ansible-playbook -u ubuntu -i ‘${aws_instance.web.public_dns},’ main.yml” } } --- - name: main hosts: all gather_facts: false connection: local tasks: - name: plan terraform: project_path: ‘terraform/’ plan_file: “{{playbook_dir}}/tfplan” lock: true state: planned 5FSSBGPSNͰ&$Λ࡞੒͠ɺ࡞੒͕׬ྃͨ͠ޙ 1MBZCPPLͰઃఆ͍ͯ͠Δ ʢޙॲཧͷΠϝʔδʣ 1MBZCPPLͷ࣮ߦ͕ࣦഊ͢Δͱɺ5FSSBGPSN্ͷঢ়ଶ͸z5BJOUFEzͱͳΔɻ ໰୊Λղܾ͠࠶౓BQQMZΛ࣮ߦ͢Δͱɺ&$͸Ұ୴࡟আ͞Εͯ࠶࡞੒͞Εͨޙɺ1MBZCPPL͕࣮ߦ͞ΕΔɻ 1MBZCPPLΛ࣮ߦ͢Δͱɺ5FSSBGPSNϞδϡʔϧ͔Βొ࿥ ͞Ε͍ͯΔ)$-Λݺͼग़͢ ʢϝΠϯॲཧͷҰ෦ʣ 5FSSBGPSN͕࡞੒ͨ͠Ϧιʔε ྫ͑͹αʔό ͷΠϯϕϯτϦ৘ใΛ͜ͷޙͷUBTL ΍3PMFͳͲʹ౉͢ඞཁ͕͋Δɻ μΠφϛοΫΠϯϕϯτϦΛ࢖ͬͯରॲ͢Δϊ΢ϋ΢͕ωοτ্Ͱݟ͚ͭΒΕ·͢ɻ ແ͠ɺ͔ͳ ͋ͬͯ΋͍

Slide 8

Slide 8 text

5PXFS͔Β࢖͏ !8 No. Ansible Terraform ༗ ແ ༗Γɾແ͠ͷཧ༝ 1 Tower Enterprise º ྆ํͱ΋ߴػೳͳ(6*͕͋Γɺશମ੍ޚʹ ͲͪΒΛ࢖͏΂͖͔෼͔Βͳ͘ͳΔ ੍ޚର৅Ͱ࢖͍෼͚ΔͷͰ͋Ε͹༗Γ 2 Tower OSS ˓ *B$੔ཧͷΑ͏ʹΠϯϑϥΛ5FSSBGPSNͰɺ ίϯϑΟάΛ"OTJCMFͰߦ͍ɺશମ੍ޚΛ 5PXFSͷϫʔΫϑϩʔͰ࣮ݱ 3 Engine Enterprise ˚ શମ੍ޚ͸5FSSBGPSN͔Β࣮ࢪɻ"OTJCMF 1MBZCPPL͕͢Ͱʹ੔උࡁΈͷ৔߹΍ 5FSSBGPSNͰ͸ίϯϑΟάͰ͖ͳ͍ࣄ߲ʹ "OTJCMFΛར༻͢Δύλʔϯ 4 Engine OSS ˚ ͦΕͧΕͰׯবͤͣʹ੍ޚର৅Ͱ࢖͍෼͚ ΔͷͰ͋Ε͹༗Γ +FOLJOTͳͲ্͕Ґʹ͍ͯɺͦΕͧΕΛผ λεΫͰ੍ޚ͢ΔͱదࡐదॴͰ࢖͑ͦ͏ ੍ޚର৅ͱͳΔγεςϜΛ྆ํͷπʔϧͰ૊Έ߹Θ੍ͤͯޚ͢Δ͔Ͳ͏͔ͱݴ͏؍఺Ͱ͢ 5PXFSͰ֎෦γεςϜ͔Βͷೝূ৘ใ࿈ܞͱͯ͠ɺ)BTIJ$PSQ7BVMU͕બ୒Ͱ͖ΔΑ͏ʹ ͳΓ·ͨ͠ɻ)BTIJ$PSQϓϩμΫτΛ׆༻͍ͯ͠Δ৔߹ͷ࿈ܞ͕ਐΉՄೳੑ͕͋Γ·͢ɻ ҎԼͷ૊Έ߹ΘͤͰͷߟ࡯

Slide 9

Slide 9 text

!9 AWS "OTJCMF5PXFSͷϫʔΫϑϩʔ͔Β࣮ߦ͢Δ 1MBZCPPLδϣϒ 8FCαʔόઃఆ ύοέʔδΞοϓσʔτɺ Πϯετʔϧɺίϯςϯπద༻ 1MBZCPPLδϣϒ σʔλઃఆ ^ ྫ͑͹ɺڭҭ؀ڥͳͲେྔʹ ·ͱΊͯߏங͢Δ৔߹ͳͲ 0OF1VTIͰ ΠϯϑϥΛߏங 71$ &-# &$ 3%4 4 8FCαʔόઃఆ ύοέʔδΞοϓσʔτɺ Πϯετʔϧɺίϯςϯπద༻ σʔλઃఆ δϣϒςϯϓϨʔτผʹ࣮ߦ͢Δํ͕γϯϓϧ͔ "84͚ͩͩͬͨΒ$'O͕͍͍ͱࢥ͏͕ɺ"[VSF ͱ͔($1΋࢖͏৔߹͸ɺ5FSSBGPSNͰ౷ҰײΛ લϖʔδ/PͷΠϝʔδ ΠϯϑϥΛߏங 71$ &-# &$ 3%4 4 5FSSBGPSN࣮ߦ༻δϣϒ 1MBZCPPL 5FSSBGPSNϞδϡʔϧ࢖༻

Slide 10

Slide 10 text

5FSSBGPSNͱ"OTJCMF͸࢖͍ ෼͚ͨํ͕͍͍ͩΖ͏ͱࢥ͏ ͦͷϦιʔεͷϥΠϑαΠΫϧʹ߹ΘͤͯπʔϧΛ࢖͍෼͚Δ
 Πϯϑϥͱ04ɾϛυϧ΢ΣΞͷϥΠϑαΠΫϧ͸ҧ͏͠
 ͨͩ͠ɺΠϯϕϯτϦͷ࿈ܞ͸ඞཁ 5FSSBGPSN͸એݴతͳϞσϧఆٛ )$- ͰΠϯϑϥΛߏஙɾมߋ͢Δ ͷ͕ےͷྑ͍࢖͍ํ ޙॲཧͰ1MBZCPPLΛݺͼग़͢ͷ͸ҧ࿨ײ͋Γ "OTJCMFͰ5FSSBGPSNϞδϡʔϧΛ࢖͏৔߹͸ɺ"OTJCMF5PXFSΛ࢖ ͏ͱݟ௨͕͠ྑ͘ͳΔͱࢥ͏ ෳ਺ͷ%4-Λ֮͑Δน͸ҙ֎ͱେ͖͍
 1MBZCPPL :".- ͱ)$-Λ֮͑Δඞཁ͕͋Γɺݱ৔ͷ఍߅͕͋Δ͔ ΋ !10 ݁ ࿦

Slide 11

Slide 11 text

·ͱΊ దࡐదॴͰ ૄ࿈ܞɺγϯϓϧӡ༻
 ʢ*B$΋ϞϊϦεԽ͠ͳ͍Α͏ʹʣ ৄࡉ͸ͪ͜ΒɹˠɹOPUFͰ !11 ຊൃද͓Αͼࢿྉʹ͍ͭͯɺॴଐ͢Δ૊৫ͱͷؔ܎͸͋Γ·ͤΜɻݸਓͷݟղͱͳΓ·͢ɻ

Slide 12

Slide 12 text

"OTJCMFϢʔβʔձ IUUQTBOTJCMFVTFSTDPOOQBTTDPN IUUQTBOTJCMFKQHJUIVCJP !12

Slide 13

Slide 13 text

!13 ओཁػೳ "OTJCMF5PXFS 5FSSBGPSN&OUFSQSJTF 8FCϕʔε6* ˓ ˓ ݖݶ؅ཧ ˓ ˓ δϣϒϫʔΫϑϩʔ ˓ º ΠϯϕϯτϦ؅ཧ ˓ ˓ 7$4࿈ܞ ˓ ˓ "OTJCMF&OHJOFʹ͸ແ͘5PXFSͷΈͰ࣮૷͞Ε͍ͯΔ΋ͷ 044൛5FSSBGPSNʹ͸ແ͘&OUFSQSJTF൛ͷΈͰ࣮૷͞Ε͍ͯΔ΋ͷ ิ଍ࢿྉ