jopf-seminar-chef-and-ansible
by
Yutaro Sugai
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ChefɾAnsibleΛ༻͍ͨڥͷ ࣗಈߏஙํ๏! ~ೖฤ~ Yutaro Sugai! 2015/2/23
Slide 2
Slide 2 text
͡Ίʹ ͜ͷൃදݸਓͷݟղͰ͋Γɺ ॴଐ͍ͯ͠Δʢ͍ͯͨ͠ʣ৫ͷݟղɺ Chef࣮ફೖஶऀਞͷݟղͰ͋Γ·ͤΜ ٕज़తʹؒҧ͍͕͋Ε ͘͞͠ࢦఠ͍ͯͩ͘͠͞
Slide 3
Slide 3 text
ࣗݾհ ɾtwitter: hokkai7go ɾGitHub: hokkai7go ɾRubyܥΧϯϑΝϨϯεͷϨϙʔτ ɾΔͼ·ฤू ɾChef࣮ફೖ ɾWebPay
Slide 4
Slide 4 text
ࠓͷ ChefAnsibleΛͬͨࣗಈԽʹ͍ͭͯ ͷɺσϞΛ͓ݟͤ͠·͢ɻ πʔϧɺίʔυͷʹͳΓ͕ͪͰ͕͢ ࠓࣗಈԽͷೖʹண͠·͢ɻ ࣗಈԽΛಋೖ͢Δࡍͷҙࢥܾఆʹཱͯͯ ͍͚ͨͩΕ͍Ͱ͢ɻ ओ࠵ऀ͔Βࣄલʹ͍࣭ͨʹ͑ͨΓɺ ࣗಈԽಋೖͷࡍʹߟ͑Δ͜ͱΛհ͠·͢ɻ
Slide 5
Slide 5 text
Chef࣮ફೖ • ධൃചதʂ • ٕज़ධ͔ࣾΒ • ݱࡏୈೋ൛ • ߽՚ࣥචਞ • ҰͰ෯͘Χόʔ
Slide 6
Slide 6 text
͓ྱ • Chef࣮ફೖͷஶऀͷΈͳ͞Μ • ൃදͷػձΛ͍͍ͭͬͯͨͩͨ͘ @miyohide ࢯ • ຊOSSਪਐϑΥʔϥϜͷؔऀͷํʑ
Slide 7
Slide 7 text
࣭͍ͤͯͩ͘͞͞ • SIerʹ͓ۈΊͷํ • ཧ৬ͷํ • ݱͷΤϯδχΞͷํ • ChefAnsibleͳͲΛͬͨ͜ͱ͕͋Δํ
Slide 8
Slide 8 text
࣭͍ͤͯͩ͘͞͞ • ChefAnsibleʹڵຯ͕͋Δํ • ࣗಈԽʹڵຯ͕͋Δํ • ͳΜͱͳ͘དྷͨํ
Slide 9
Slide 9 text
େࣄͳ͜ͱ • ChefɾAnsibleͱ໊ʹ͋Γ·͕͢ɺ πʔϧͷಋೖ͕తͰ͋Γ·ͤΜ
Slide 10
Slide 10 text
େࣄͳ͜ͱ • ࣗಈԽࢸΔಓ • ࣗಈԽΛҡ࣋͢Δϓϩηε
Slide 11
Slide 11 text
ࣗಈԽ! ͱ
Slide 12
Slide 12 text
ࣗಈԽͱ https://kotobank.jp/word/ࣗಈԽ-681577ɹΑΓҾ༻ ͡Ͳ͏‐͔ʤ‐ΫϫʥʲࣗಈԽʳ ! ʦ໊ʧ(εϧ)ਓखʹΑΒͣɺػցίϯϐϡʔλʔʹΑΔॲཧ ํࣜʹม͑Δ͜ͱɻʮఔͷʕΛ࣮ݱ͢Δʯ
Slide 13
Slide 13 text
ࣗಈԽ ࢲୡ͕࣮ݱ͍ͨ͠ͷɺ ɾαʔόߏங ɾӡ༻ ɹͷࣗಈԽ
Slide 14
Slide 14 text
ࣗಈԽ ͍͖ͳΓ ɾπʔϧ ɾίʔυ ͷʹͳΔͷૣٸ͗͢Δ
Slide 15
Slide 15 text
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ • མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ
Slide 16
Slide 16 text
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ • མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ ӡ༻ʹؔΘΔਓΛ ר͖ࠐΉඞཁ
Slide 17
Slide 17 text
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ • མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ ϓϩμΫτͷཧղ
Slide 18
Slide 18 text
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ • མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ Ұ൪େࣄͳͱ͜Ζ
Slide 19
Slide 19 text
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ • མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ ஈ֊ʹΑΓ Δ͜ͱ͕มΘΔ
Slide 20
Slide 20 text
ࣗಈԽͷϝϦοτ • Πϯϑϥͷߏஙɾӡ༻ΛίʔυͰࣗಈԽ • αʔόʹࠨӈ͞Εͳ͍ • Φϖϛεͷݮ • ޮԽʢͷݮʣ • ଐਓੑͷഉআ • खॱॻ͔Βͷଔۀ • ਖ਼͔֬ͭߴ
Slide 21
Slide 21 text
ࣗಈԽͷσϝϦοτ • σϝϦοτ • ࣌ؒͱख͕͔͔ؒΔ • ܧଓతʹอक͢Δ࣌ؒͱखؒ
Slide 22
Slide 22 text
ࣗಈԽʹσϝϦοτ ͕͋Δͱ͍͑ɺ! ख࡞ۀ+खॱॻͭ Β͍
Slide 23
Slide 23 text
• ਫΛҿΉ • ࣍ɺࣗಈԽͷಋೖํ๏ʹ͍ͭͯ
Slide 24
Slide 24 text
Ͳ͏ͬͯࣗಈԽΛ ಋೖͨ͠Β͍͍ͷʁ
Slide 25
Slide 25 text
ಋೖ • λΠϛϯά • ϓϩδΣΫτ͕࢝·Δͱ͖ • ։ൃڥΛߏங͢Δͱ͖ • طଘͷγεςϜʹಋೖ͢Δͱ͖ • ্هҎ֎ͷ߹(൪֎ฤ)
Slide 26
Slide 26 text
ಋೖ(PJ։࢝࣌) • ϓϩδΣΫτ։࢝࣌ʹࣗಈԽ͓͖͍ͯͨ͠ͷ • σϓϩΠɾCIɾߏஙࣗಈԽ • ࣮ࡍʹಈ͘ίʔυ͕ͳͯ͘Ζ͏ • ϓϩηεΛ܁Γฦ͠վળ͢Δ͜ͱ͕Ͱ͖Δ
Slide 27
Slide 27 text
ಋೖ(։ൃڥߏங) • ಉ͡ڥΛૉૣ͘։ൃऀʹͰ͖ΔΑ͏ʹͳΔ • όʔδϣϯͷҧ͍Ͱ·ͳ͘ͳΔ • ϝϯόʔ૿͑ͨ࣌ʹѹతʹָ • VagrantͱΈ߹ΘͤΕߏஙͷΓ͕͍͢͠͠ • Chef, Ansibleͷೖʹ͓͢͢Ί • Chef࣮ફೖ5,6ষ͓͢͢Ί • [ؾΛ͚ͭΔ͜ͱ] όʔδϣϯཧ͠ɺܧଓతʹมߋΛՃ͑ ΒΕΔΑ͏ʹ͓ͯ͘͠
Slide 28
Slide 28 text
ಋೖ(։ൃڥߏங) ᶃ VM Imageऔಘ ᶄ ϦϙδτϦ͔Β ίʔυऔಘ ίʔυΛऔಘͯ͠ ܧଓతʹϓϩϏδϣχϯά
Slide 29
Slide 29 text
ಋೖ(طଘͷγεςϜ) • Ұ൪Ή͔͍ͣ͠ • ՔಇதͷαʔϏεʹӨڹΛ༩͍͑ͨ͢Ί • αʔόՃ͕͋ΕҰ൪ͱ͖͍ͬͭ͢
Slide 30
Slide 30 text
ಋೖ(൪֎ฤ) • ڥ͕มԽ͢Δͱ͖ʹಋೖ͢Δ • αʔόҠߦ • PaaS, IaaSͳͲͷҠߦ • ·ͬ͞ΒͳαʔόΛࣗಈԽͰߏங
Slide 31
Slide 31 text
ಋೖ(จԽ) • จԽͷಋೖ͕େࣄͰɺࠎ͕ંΕΔ͔ • ख࡞ۀΛͳ͘͠ɺࣗಈԽͰͷ࡞ۀத৺ʹ • ݽಠͳChef(ͳͲ)͍ʹͳͬͯ͠·Θͳ͍Α͏ • ·ͣಡΈॻ͖ग़དྷΔؒΛ૿͢ • Ξϯνύλʔϯʹؾ͕͚ΔਓΛ૿͢ • ѻ͏ϛυϧΣΞOSɺίϚϯυͷཧղ͕Լͱͯ͠ඞཁʹ ͳͬͯ͘Δ • ϝϯςφϯεੑ • ಡΈॻ͖͕͍͢͠ • ӡ༻ʹϑΟοτ͢Δ͔
Slide 32
Slide 32 text
ࣄલʹ͍࣭ͨ(1) “࣮ࡍʹɺChefΛͬͯɺRailsΞϓϦ͕ಈ͘ڥΛߏஙͯ͠ཉ͍͠ ! ʢChefͷΠϯετʔϧ͔Β͡ΊͯɺRailsΞϓϦ͕ಈ͘·Ͱʣ”! ! →͜ͷ͋ͱσϞಈըΛ͓ݟͤ͠·͢
Slide 33
Slide 33 text
ࣄલʹ͍࣭ͨ(2) ”ChefͰݕࡧ͢ΔͱɺChef SoloɺChef ServerɺKnifeɺCookbookɺ ! ϨγϐɺBerkshelfͳͲɺ͞·͟·ͳ༻ޠ͕ͨ͘͞Μ͋Γ ! Α͔͘Βͳ͍ɻཧͯ͠ཉ͍͠ɻ”! ! →Chef Solo: ελϯυΞϩϯܗࣜͷChef! →Chef Server: Chef ClientͱڞʹΫϥΠΞϯτ/αʔόܗࣜͷChef! →Ϩγϐ: Ұ൪جૅతͳߏཁૉɻίʔυͰॻ͍ͨઃఆखॱ! →Cookbook: ϨγϐʹඞཁͳσʔλϑΝΠϧΛ·ͱΊͨͷ! →Knife: खݩͷΫοΫϒοΫͱରͷαʔόΛͭͳ͙ίϚϯυϥΠϯπʔϧ
Slide 34
Slide 34 text
ࣄલʹ͍࣭ͨ(2) http://www.slideshare.net/yandod/devopschef-chef12 ΑΓҾ༻ Chef ServerΛͬͨߏ
Slide 35
Slide 35 text
ࣄલʹ͍࣭ͨ(2) http://www.slideshare.net/yandod/devopschef-chef12 ΑΓҾ༻
Slide 36
Slide 36 text
ࣄલʹ͍࣭ͨ(3) “RubyͷDSLΛॻ͘͜ͱͰαʔόߏஙͷࣗಈԽ͕ߦ͑Δͱͷ͜ͱ͕ͩɺ ! θϩ͔Βͯ͢Λॻ͖ى͜͢ͷେมͩ͠ɺֶशίετ͕ߴ͗͢Δ ! Α͏ʹࢥ͏ɻApacheRuby,PassengerͳͲΛΠϯετʔϧ͢ΔͨΊͷ ! ςϯϓϨʔτ͋Δͷ͔ʁ “! ! →͍͍࣭Ͱ͢Ͷʂ! →Chef supermarket( https://supermarket.chef.io/ )͕͋Γ·͢ɻ! ! ͝ར༻ܭըతʹ! ʢΉͷͰͳ͍Մೳੑɺ݁ہιʔείʔυΛಡΉӋʹͳΔ͜ͱʣ
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
Chef Supermarket • ୭͕ϝϯς͍ͯ͠Δͷʁ! • Chefࣾ! • PayPal! • HiganWorks! • Chef׆༻ΨΠυஶऀͷᖒొ͞Μͷձࣾ! • ͳͲͳͲ(ΫοΫϒοΫ࣍ୈ)! • ͲΜͳΫοΫϒοΫ͕͋Δͷʁ! • nginx! • apache2! • rbenv! • postgresql! • mysql! • docker! • ͳͲͳͲ
Slide 39
Slide 39 text
ࣄલʹ͍࣭ͨ(4) “RubyͷDSLͰࣗಈԽͰ͖Δͷָͩͱࢥ͏͕ɺςετ ! ͲͷΑ͏ʹ͢Δͷ͔ɻ “! ! →͍͍࣭Ͱ͢Ͷʂ! →test-kitchen, Serverspec Infrataster Ͱςετ͢Δͷ͕ྑͦ͞͏! →͔͠͠ɺ·ͩϕετϓϥΫςΟεͳ͍ͱೝ͍ࣝͯ͠Δ! →ࣗಈԽͷՌΛ֬ೝ͢Δͷ͕େࣄ! →ςετʹ࣌ؒΛ͍ա͗ͳ͍Α͏ʹɺ·ͣεϞʔϧελʔτͰ! ʢࣗಈԽʹɺςετʹ͕͔͔࣌ؒΔͱվળͷαΠΫϧΛճ͠ʹ͍͘ʣ
Slide 40
Slide 40 text
http://serverspec.org/ ΑΓ
Slide 41
Slide 41 text
http://infrataster.net/ ΑΓ
Slide 42
Slide 42 text
ࣄલʹ͍࣭ͨ(5) “్தͰࣦഊͨ͠ޙʹ࠶ɺ࣮ߦͯ͠ͳ͍͔ɻ ! ࣗ࡞ͷγΣϧεΫϦϓτͳͲͰࣗಈԽΛࢼΈΔͱɺϦϥϯॲཧͷ ! ࡞ΓࠐΈ͕େมɻ “! ! →ͳ͍ɻ! →ႈੑ(Կ࣮ߦͯ͠ಉ݁͡ՌʹͳΔੑ࣭ͷ͜ͱ)Λߟྀͯ͠ॻ͔Εͨ ϨγϐͰ͋Εͳ͍ɻ! →ʮखॱʯͰͳ͘ʮঢ়ଶʯΛఆٛ͢ΕΑ͍(Chef࣮ફೖ §2.10 p49)! →ྫ͑…(࣍ͷεϥΠυ
Slide 43
Slide 43 text
ྫ͑ɺgit clone͢Δͱ͖ ॳճ͚ͩclone͍ͨ͠ͳΒɺ࣍ճҎ࣮߱ߦ͢Δඞཁ͕ͳ͍ bash_profileΛϗʔϜσΟϨΫτϦʹஔ͍͕ͨ͠ aaa ͱ͍͏༰ؚ͕·Ε͍ͯΔͳΒɺมߋΛՃ͑ͨ͘ͳ͍ http://qiita.com/hokkai7go@github/items/37895052b52105be4c51 ΑΓ
Slide 44
Slide 44 text
ࣄલʹ͍࣭ͨ(6) “αʔόݻ༗ͷઃఆʢϗετ໊IPΞυϨεʣͳͲΛChefͰ ! ࣮ݱ͢Δ͜ͱՄೳ͔ʁͦ͜Γख࡞ۀ͔ʁ “! ! →Մೳ͕ͩɺΫϥυڥΛ͍ͬͯͨͷͰݸਓతʹ͋·Γܦݧ͕ͳ͍! →ϗετ໊IPΞυϨεͷඥ͚Λཧ͢Δͷ͕ࡶͦ͏ʹࢥ͏
Slide 45
Slide 45 text
ࣄલʹ͍࣭ͨ(7) “Chefʹࣅͨπʔϧͱͯ͠PuppetansibleͳͲ͕͋ΔΑ͏͕ͩɺ ! ͦΕͧΕͷಛʁ “! ! →͍͍࣭Ͱ͢Ͷʂ
Slide 46
Slide 46 text
πʔϧൺֱ Chef Ansible Itamae γΣϧεΫϦϓτ อकੑ ○ ○ ○ ☓ ಋೖָ͕͔ ˚ ○ ○ ○ কདྷੑ ○ ○ ○ ? қ ˚ ○ ˕ ˚ ϓϥοτ ϑΥʔϜ ˕ ○ ○ ○
Slide 47
Slide 47 text
πʔϧൺֱ • Chef • RubyͳͷͰΘ͔Γ͍͕͢ɺεΫϦϓτ͕ཚཱ͠ͳ͍ Α͏ؾΛ͚ͭΔඞཁ͕͋Δ • ͍ΖΜͳͱ͜ΖͰίʔυΛࠩ͠ࠐΊΔɺ͘·ͳ͘ಡ Ήඞཁ͕͋ΔΑ͏ʹࢥ͏ • ઃఆରͷαʔόʹΤʔδΣϯτ(Ruby)ΛΠϯετʔ ϧ͢Δඞཁ͕͋Δ • ར༻ऀ૿͍͑ͯ͘ͱࢥ͏ • WindowsAzureʹରԠ͍ͯ͠Δ༷(Chef12͔Β)
Slide 48
Slide 48 text
πʔϧൺֱ • Ansible • γϯϓϧͰͱͯΑ͍ • ͔͠͠ɺyamlͰԿ͔ॻ͘ͷʹແཧ͕͋Δ ؾ͕͢Δ • ར༻ऀ૿͍͑ͯ͘ͱࢥ͏ • ΤʔδΣϯτϨε࠷ߴʂ • SSH͑͞Ͱ͖ΕΑ͍
Slide 49
Slide 49 text
πʔϧൺֱ • Itamae • Chef͔ΒൃΛಘͨγϯϓϧͰܰྔͳπʔϧ • ຊਓ͕։ൃɻใΛಘ͍͢ • RubyͳͷͰΘ͔Γ͍͢ • ར༻ऀ૿͍͑ͯ͘ͱࢥ͏ • ΤʔδΣϯτϨε࠷ߴʂ
Slide 50
Slide 50 text
πʔϧൺֱ • γΣϧεΫϦϓτ • ॻ͘ͷϝϯςφϯεେม • Θ͔Γʹ͍͘ͷͱɺႈੑͷߟྀ͕େม • EC2ͷcloud-initͷΑ͏ʹɺॳظߏஙͰڧྗ • γΣϧͷํݴΛߟྀ͢Δඞཁ͕͋Δ
Slide 51
Slide 51 text
·ͱΊ • πʔϧ͕େࣄͰͳ͍ • ࣗಈԽࢸΔಓ • ࣗಈԽΛҡ࣋͢Δϓϩηε • ͦͷ্Ͱɺࣗͨͪͷ৫ͰͲͷπʔϧΛબͿ͔ • จԽͷಋೖ͕େม͕ͩେࣄ • ʢͳͥಋೖ͢Δͷ͔ͱ͍ͬͨʣ͚ࣾϙΤϜΛॻ͘ ͱΘΓ͍͔͢ • ࣄྫΛΓ͍ͨͷͰɺͥͻൃද͍ͯͩ͘͠͞
Slide 52
Slide 52 text
Q&A • ೖฤͷൃද͜ΕͰऴΘΓͰ͢ • ࣭͋Γ·͔͢ʁ
Slide 53
Slide 53 text
ChefɾAnsibleΛ༻͍ͨڥͷ ࣗಈߏஙํ๏! ~σϞฤ~ Yutaro Sugai! 2015/2/23
Slide 54
Slide 54 text
σϞ • Vagrant + Chef soloΛͬͯߏங! • vagrantͷػೳͰ͋ΔprovisionerΛར༻! • ChefͷagentΠϯετʔϧVagrant͕ࣗಈͰͬͯ͘ΕΔ! • ΫοΫϒοΫ! • جຊతʹChef supermarketͷͷΛར༻! • nginx! • postgresql! • nodejs! • rbenv(RubyͷΠϯετʔϧཧ)! • ࣗલͰॻ͍ͨͷ্هΫοΫϒοΫͷݺͼग़͠ɺnginxͷݻ༗ઃ ఆͷΈ! • σϓϩΠrailsΞϓϦଆ͔ΒcapistranoΛར༻ͯ͠ߦ͏