Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
jopf-seminar-chef-and-ansible
Search
Yutaro Sugai
February 23, 2015
Technology
3
3.9k
jopf-seminar-chef-and-ansible
Chef・Ansible等を用いた環境の自動構築方法
日本OSS推進フォーラム主催 第5回アプリケーション部会勉強会
http://connpass.com/event/11707/
Yutaro Sugai
February 23, 2015
Tweet
Share
More Decks by Yutaro Sugai
See All by Yutaro Sugai
devlove-kansai-sre-scrum
hokkai7go
0
10k
sre-lounge8
hokkai7go
6
6.5k
88_techbookfest5_in_omotesandorb
hokkai7go
1
100
Career Keynote at LDD '18 in Muroran
hokkai7go
1
560
What has been realized to improve maintainability at "Eight".
hokkai7go
0
920
Serverless and tough access management
hokkai7go
1
1.4k
"1st try and team productivity"
hokkai7go
1
300
Technology to support Eight, Infrastructure part
hokkai7go
0
580
AWS and Serverless and Monitoring
hokkai7go
1
2.1k
Other Decks in Technology
See All in Technology
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
2
250
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
20241220_S3 tablesの使い方を検証してみた
handy
3
370
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
470
UI State設計とテスト方針
rmakiyama
2
470
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
1
1.3k
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
Six Lessons from altMBA
skipperchong
27
3.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Site-Speed That Sticks
csswizardry
2
190
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Building Applications with DynamoDB
mza
91
6.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Transcript
ChefɾAnsibleΛ༻͍ͨڥͷ ࣗಈߏஙํ๏! ~ೖฤ~ Yutaro Sugai! 2015/2/23
͡Ίʹ ͜ͷൃදݸਓͷݟղͰ͋Γɺ ॴଐ͍ͯ͠Δʢ͍ͯͨ͠ʣ৫ͷݟղɺ Chef࣮ફೖஶऀਞͷݟղͰ͋Γ·ͤΜ ٕज़తʹؒҧ͍͕͋Ε ͘͞͠ࢦఠ͍ͯͩ͘͠͞
ࣗݾհ ɾtwitter: hokkai7go ɾGitHub: hokkai7go ɾRubyܥΧϯϑΝϨϯεͷϨϙʔτ ɾΔͼ·ฤू ɾChef࣮ફೖ ɾWebPay
ࠓͷ ChefAnsibleΛͬͨࣗಈԽʹ͍ͭͯ ͷɺσϞΛ͓ݟͤ͠·͢ɻ πʔϧɺίʔυͷʹͳΓ͕ͪͰ͕͢ ࠓࣗಈԽͷೖʹண͠·͢ɻ ࣗಈԽΛಋೖ͢Δࡍͷҙࢥܾఆʹཱͯͯ ͍͚ͨͩΕ͍Ͱ͢ɻ ओ࠵ऀ͔Βࣄલʹ͍࣭ͨʹ͑ͨΓɺ ࣗಈԽಋೖͷࡍʹߟ͑Δ͜ͱΛհ͠·͢ɻ
Chef࣮ફೖ • ධൃചதʂ • ٕज़ධ͔ࣾΒ • ݱࡏୈೋ൛ • ߽՚ࣥචਞ •
ҰͰ෯͘Χόʔ
͓ྱ • Chef࣮ફೖͷஶऀͷΈͳ͞Μ • ൃදͷػձΛ͍͍ͭͬͯͨͩͨ͘ @miyohide ࢯ • ຊOSSਪਐϑΥʔϥϜͷؔऀͷํʑ
࣭͍ͤͯͩ͘͞͞ • SIerʹ͓ۈΊͷํ • ཧ৬ͷํ • ݱͷΤϯδχΞͷํ • ChefAnsibleͳͲΛͬͨ͜ͱ͕͋Δํ
࣭͍ͤͯͩ͘͞͞ • ChefAnsibleʹڵຯ͕͋Δํ • ࣗಈԽʹڵຯ͕͋Δํ • ͳΜͱͳ͘དྷͨํ
େࣄͳ͜ͱ • ChefɾAnsibleͱ໊ʹ͋Γ·͕͢ɺ πʔϧͷಋೖ͕తͰ͋Γ·ͤΜ
େࣄͳ͜ͱ • ࣗಈԽࢸΔಓ • ࣗಈԽΛҡ࣋͢Δϓϩηε
ࣗಈԽ! ͱ
ࣗಈԽͱ https://kotobank.jp/word/ࣗಈԽ-681577ɹΑΓҾ༻ ͡Ͳ͏‐͔ʤ‐ΫϫʥʲࣗಈԽʳ ! ʦ໊ʧ(εϧ)ਓखʹΑΒͣɺػցίϯϐϡʔλʔʹΑΔॲཧ ํࣜʹม͑Δ͜ͱɻʮఔͷʕΛ࣮ݱ͢Δʯ
ࣗಈԽ ࢲୡ͕࣮ݱ͍ͨ͠ͷɺ ɾαʔόߏங ɾӡ༻ ɹͷࣗಈԽ
ࣗಈԽ ͍͖ͳΓ ɾπʔϧ ɾίʔυ ͷʹͳΔͷૣٸ͗͢Δ
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ •
མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ •
མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ ӡ༻ʹؔΘΔਓΛ ר͖ࠐΉඞཁ
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ •
མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ ϓϩμΫτͷཧղ
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ •
མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ Ұ൪େࣄͳͱ͜Ζ
తͷલʹ • ͲΜͳ৫ʁ • ͲΜͳϓϩμΫτʁ • ͩΕ͕ϓϩμΫτΛ͏ͷʁ • ϓϩμΫτ͕མͪΔͱ୭͕ࠔΔͷʁ •
མͪͨϓϩμΫτΛ୭͕͢ͷʁ • ࣗಈԽͰԿΛղܾ͢Δͷʁ • ϦϦʔεΛओಋ͢Δͷ୭ʁͲͷ৫ʁ • ϓϩδΣΫτࠓɺͲΜͳஈ֊ʁ ஈ֊ʹΑΓ Δ͜ͱ͕มΘΔ
ࣗಈԽͷϝϦοτ • Πϯϑϥͷߏஙɾӡ༻ΛίʔυͰࣗಈԽ • αʔόʹࠨӈ͞Εͳ͍ • Φϖϛεͷݮ • ޮԽʢͷݮʣ •
ଐਓੑͷഉআ • खॱॻ͔Βͷଔۀ • ਖ਼͔֬ͭߴ
ࣗಈԽͷσϝϦοτ • σϝϦοτ • ࣌ؒͱख͕͔͔ؒΔ • ܧଓతʹอक͢Δ࣌ؒͱखؒ
ࣗಈԽʹσϝϦοτ ͕͋Δͱ͍͑ɺ! ख࡞ۀ+खॱॻͭ Β͍
• ਫΛҿΉ • ࣍ɺࣗಈԽͷಋೖํ๏ʹ͍ͭͯ
Ͳ͏ͬͯࣗಈԽΛ ಋೖͨ͠Β͍͍ͷʁ
ಋೖ • λΠϛϯά • ϓϩδΣΫτ͕࢝·Δͱ͖ • ։ൃڥΛߏங͢Δͱ͖ • طଘͷγεςϜʹಋೖ͢Δͱ͖ •
্هҎ֎ͷ߹(൪֎ฤ)
ಋೖ(PJ։࢝࣌) • ϓϩδΣΫτ։࢝࣌ʹࣗಈԽ͓͖͍ͯͨ͠ͷ • σϓϩΠɾCIɾߏஙࣗಈԽ • ࣮ࡍʹಈ͘ίʔυ͕ͳͯ͘Ζ͏ • ϓϩηεΛ܁Γฦ͠վળ͢Δ͜ͱ͕Ͱ͖Δ
ಋೖ(։ൃڥߏங) • ಉ͡ڥΛૉૣ͘։ൃऀʹͰ͖ΔΑ͏ʹͳΔ • όʔδϣϯͷҧ͍Ͱ·ͳ͘ͳΔ • ϝϯόʔ૿͑ͨ࣌ʹѹతʹָ • VagrantͱΈ߹ΘͤΕߏஙͷΓ͕͍͢͠͠ •
Chef, Ansibleͷೖʹ͓͢͢Ί • Chef࣮ફೖ5,6ষ͓͢͢Ί • [ؾΛ͚ͭΔ͜ͱ] όʔδϣϯཧ͠ɺܧଓతʹมߋΛՃ͑ ΒΕΔΑ͏ʹ͓ͯ͘͠
ಋೖ(։ൃڥߏங) ᶃ VM Imageऔಘ ᶄ ϦϙδτϦ͔Β ίʔυऔಘ ίʔυΛऔಘͯ͠ ܧଓతʹϓϩϏδϣχϯά
ಋೖ(طଘͷγεςϜ) • Ұ൪Ή͔͍ͣ͠ • ՔಇதͷαʔϏεʹӨڹΛ༩͍͑ͨ͢Ί • αʔόՃ͕͋ΕҰ൪ͱ͖͍ͬͭ͢
ಋೖ(൪֎ฤ) • ڥ͕มԽ͢Δͱ͖ʹಋೖ͢Δ • αʔόҠߦ • PaaS, IaaSͳͲͷҠߦ • ·ͬ͞ΒͳαʔόΛࣗಈԽͰߏங
ಋೖ(จԽ) • จԽͷಋೖ͕େࣄͰɺࠎ͕ંΕΔ͔ • ख࡞ۀΛͳ͘͠ɺࣗಈԽͰͷ࡞ۀத৺ʹ • ݽಠͳChef(ͳͲ)͍ʹͳͬͯ͠·Θͳ͍Α͏ • ·ͣಡΈॻ͖ग़དྷΔؒΛ૿͢ •
Ξϯνύλʔϯʹؾ͕͚ΔਓΛ૿͢ • ѻ͏ϛυϧΣΞOSɺίϚϯυͷཧղ͕Լͱͯ͠ඞཁʹ ͳͬͯ͘Δ • ϝϯςφϯεੑ • ಡΈॻ͖͕͍͢͠ • ӡ༻ʹϑΟοτ͢Δ͔
ࣄલʹ͍࣭ͨ(1) “࣮ࡍʹɺChefΛͬͯɺRailsΞϓϦ͕ಈ͘ڥΛߏஙͯ͠ཉ͍͠ ! ʢChefͷΠϯετʔϧ͔Β͡ΊͯɺRailsΞϓϦ͕ಈ͘·Ͱʣ”! ! →͜ͷ͋ͱσϞಈըΛ͓ݟͤ͠·͢
ࣄલʹ͍࣭ͨ(2) ”ChefͰݕࡧ͢ΔͱɺChef SoloɺChef ServerɺKnifeɺCookbookɺ ! ϨγϐɺBerkshelfͳͲɺ͞·͟·ͳ༻ޠ͕ͨ͘͞Μ͋Γ ! Α͔͘Βͳ͍ɻཧͯ͠ཉ͍͠ɻ”! ! →Chef
Solo: ελϯυΞϩϯܗࣜͷChef! →Chef Server: Chef ClientͱڞʹΫϥΠΞϯτ/αʔόܗࣜͷChef! →Ϩγϐ: Ұ൪جૅతͳߏཁૉɻίʔυͰॻ͍ͨઃఆखॱ! →Cookbook: ϨγϐʹඞཁͳσʔλϑΝΠϧΛ·ͱΊͨͷ! →Knife: खݩͷΫοΫϒοΫͱରͷαʔόΛͭͳ͙ίϚϯυϥΠϯπʔϧ
ࣄલʹ͍࣭ͨ(2) http://www.slideshare.net/yandod/devopschef-chef12 ΑΓҾ༻ Chef ServerΛͬͨߏ
ࣄલʹ͍࣭ͨ(2) http://www.slideshare.net/yandod/devopschef-chef12 ΑΓҾ༻
ࣄલʹ͍࣭ͨ(3) “RubyͷDSLΛॻ͘͜ͱͰαʔόߏஙͷࣗಈԽ͕ߦ͑Δͱͷ͜ͱ͕ͩɺ ! θϩ͔Βͯ͢Λॻ͖ى͜͢ͷେมͩ͠ɺֶशίετ͕ߴ͗͢Δ ! Α͏ʹࢥ͏ɻApacheRuby,PassengerͳͲΛΠϯετʔϧ͢ΔͨΊͷ ! ςϯϓϨʔτ͋Δͷ͔ʁ “! !
→͍͍࣭Ͱ͢Ͷʂ! →Chef supermarket( https://supermarket.chef.io/ )͕͋Γ·͢ɻ! ! ͝ར༻ܭըతʹ! ʢΉͷͰͳ͍Մೳੑɺ݁ہιʔείʔυΛಡΉӋʹͳΔ͜ͱʣ
None
Chef Supermarket • ୭͕ϝϯς͍ͯ͠Δͷʁ! • Chefࣾ! • PayPal! • HiganWorks!
• Chef׆༻ΨΠυஶऀͷᖒొ͞Μͷձࣾ! • ͳͲͳͲ(ΫοΫϒοΫ࣍ୈ)! • ͲΜͳΫοΫϒοΫ͕͋Δͷʁ! • nginx! • apache2! • rbenv! • postgresql! • mysql! • docker! • ͳͲͳͲ
ࣄલʹ͍࣭ͨ(4) “RubyͷDSLͰࣗಈԽͰ͖Δͷָͩͱࢥ͏͕ɺςετ ! ͲͷΑ͏ʹ͢Δͷ͔ɻ “! ! →͍͍࣭Ͱ͢Ͷʂ! →test-kitchen, Serverspec
Infrataster Ͱςετ͢Δͷ͕ྑͦ͞͏! →͔͠͠ɺ·ͩϕετϓϥΫςΟεͳ͍ͱೝ͍ࣝͯ͠Δ! →ࣗಈԽͷՌΛ֬ೝ͢Δͷ͕େࣄ! →ςετʹ࣌ؒΛ͍ա͗ͳ͍Α͏ʹɺ·ͣεϞʔϧελʔτͰ! ʢࣗಈԽʹɺςετʹ͕͔͔࣌ؒΔͱվળͷαΠΫϧΛճ͠ʹ͍͘ʣ
http://serverspec.org/ ΑΓ
http://infrataster.net/ ΑΓ
ࣄલʹ͍࣭ͨ(5) “్தͰࣦഊͨ͠ޙʹ࠶ɺ࣮ߦͯ͠ͳ͍͔ɻ ! ࣗ࡞ͷγΣϧεΫϦϓτͳͲͰࣗಈԽΛࢼΈΔͱɺϦϥϯॲཧͷ ! ࡞ΓࠐΈ͕େมɻ “! ! →ͳ͍ɻ! →ႈੑ(Կ࣮ߦͯ͠ಉ݁͡ՌʹͳΔੑ࣭ͷ͜ͱ)Λߟྀͯ͠ॻ͔Εͨ
ϨγϐͰ͋Εͳ͍ɻ! →ʮखॱʯͰͳ͘ʮঢ়ଶʯΛఆٛ͢ΕΑ͍(Chef࣮ફೖ §2.10 p49)! →ྫ͑…(࣍ͷεϥΠυ
ྫ͑ɺgit clone͢Δͱ͖ ॳճ͚ͩclone͍ͨ͠ͳΒɺ࣍ճҎ࣮߱ߦ͢Δඞཁ͕ͳ͍ bash_profileΛϗʔϜσΟϨΫτϦʹஔ͍͕ͨ͠ aaa ͱ͍͏༰ؚ͕·Ε͍ͯΔͳΒɺมߋΛՃ͑ͨ͘ͳ͍ http://qiita.com/hokkai7go@github/items/37895052b52105be4c51 ΑΓ
ࣄલʹ͍࣭ͨ(6) “αʔόݻ༗ͷઃఆʢϗετ໊IPΞυϨεʣͳͲΛChefͰ ! ࣮ݱ͢Δ͜ͱՄೳ͔ʁͦ͜Γख࡞ۀ͔ʁ “! ! →Մೳ͕ͩɺΫϥυڥΛ͍ͬͯͨͷͰݸਓతʹ͋·Γܦݧ͕ͳ͍! →ϗετ໊IPΞυϨεͷඥ͚Λཧ͢Δͷ͕ࡶͦ͏ʹࢥ͏
ࣄલʹ͍࣭ͨ(7) “Chefʹࣅͨπʔϧͱͯ͠PuppetansibleͳͲ͕͋ΔΑ͏͕ͩɺ ! ͦΕͧΕͷಛʁ “! ! →͍͍࣭Ͱ͢Ͷʂ
πʔϧൺֱ Chef Ansible Itamae γΣϧεΫϦϓτ อकੑ ◦ ◦ ◦ ☓
ಋೖָ͕͔ ˚ ◦ ◦ ◦ কདྷੑ ◦ ◦ ◦ ? қ ˚ ◦ ˕ ˚ ϓϥοτ ϑΥʔϜ ˕ ◦ ◦ ◦
πʔϧൺֱ • Chef • RubyͳͷͰΘ͔Γ͍͕͢ɺεΫϦϓτ͕ཚཱ͠ͳ͍ Α͏ؾΛ͚ͭΔඞཁ͕͋Δ • ͍ΖΜͳͱ͜ΖͰίʔυΛࠩ͠ࠐΊΔɺ͘·ͳ͘ಡ Ήඞཁ͕͋ΔΑ͏ʹࢥ͏ •
ઃఆରͷαʔόʹΤʔδΣϯτ(Ruby)ΛΠϯετʔ ϧ͢Δඞཁ͕͋Δ • ར༻ऀ૿͍͑ͯ͘ͱࢥ͏ • WindowsAzureʹରԠ͍ͯ͠Δ༷(Chef12͔Β)
πʔϧൺֱ • Ansible • γϯϓϧͰͱͯΑ͍ • ͔͠͠ɺyamlͰԿ͔ॻ͘ͷʹແཧ͕͋Δ ؾ͕͢Δ • ར༻ऀ૿͍͑ͯ͘ͱࢥ͏
• ΤʔδΣϯτϨε࠷ߴʂ • SSH͑͞Ͱ͖ΕΑ͍
πʔϧൺֱ • Itamae • Chef͔ΒൃΛಘͨγϯϓϧͰܰྔͳπʔϧ • ຊਓ͕։ൃɻใΛಘ͍͢ • RubyͳͷͰΘ͔Γ͍͢ •
ར༻ऀ૿͍͑ͯ͘ͱࢥ͏ • ΤʔδΣϯτϨε࠷ߴʂ
πʔϧൺֱ • γΣϧεΫϦϓτ • ॻ͘ͷϝϯςφϯεେม • Θ͔Γʹ͍͘ͷͱɺႈੑͷߟྀ͕େม • EC2ͷcloud-initͷΑ͏ʹɺॳظߏஙͰڧྗ •
γΣϧͷํݴΛߟྀ͢Δඞཁ͕͋Δ
·ͱΊ • πʔϧ͕େࣄͰͳ͍ • ࣗಈԽࢸΔಓ • ࣗಈԽΛҡ࣋͢Δϓϩηε • ͦͷ্Ͱɺࣗͨͪͷ৫ͰͲͷπʔϧΛબͿ͔ •
จԽͷಋೖ͕େม͕ͩେࣄ • ʢͳͥಋೖ͢Δͷ͔ͱ͍ͬͨʣ͚ࣾϙΤϜΛॻ͘ ͱΘΓ͍͔͢ • ࣄྫΛΓ͍ͨͷͰɺͥͻൃද͍ͯͩ͘͠͞
Q&A • ೖฤͷൃද͜ΕͰऴΘΓͰ͢ • ࣭͋Γ·͔͢ʁ
ChefɾAnsibleΛ༻͍ͨڥͷ ࣗಈߏஙํ๏! ~σϞฤ~ Yutaro Sugai! 2015/2/23
σϞ • Vagrant + Chef soloΛͬͯߏங! • vagrantͷػೳͰ͋ΔprovisionerΛར༻! • ChefͷagentΠϯετʔϧVagrant͕ࣗಈͰͬͯ͘ΕΔ!
• ΫοΫϒοΫ! • جຊతʹChef supermarketͷͷΛར༻! • nginx! • postgresql! • nodejs! • rbenv(RubyͷΠϯετʔϧཧ)! • ࣗલͰॻ͍ͨͷ্هΫοΫϒοΫͷݺͼग़͠ɺnginxͷݻ༗ઃ ఆͷΈ! • σϓϩΠrailsΞϓϦଆ͔ΒcapistranoΛར༻ͯ͠ߦ͏