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
初めてのChefの教室
Search
Yusuke Ando
February 22, 2013
Programming
19
28k
初めてのChefの教室
2/22に株式会社Engine Yardで開催した非インフラエンジニア向けChef入門講座です。
Yusuke Ando
February 22, 2013
Tweet
Share
More Decks by Yusuke Ando
See All by Yusuke Ando
CakePHP3でアプリ開発
yandod
1
340
Shimokita.Unity パーティクルでエフェクト
yandod
0
760
CakePHP3の明るい未来
yandod
1
200
Testing your app with Selenium on Travis CI
yandod
8
3.1k
Testing your app with Selenium on Travis CI
yandod
0
130
Inputで入力を扱う
yandod
0
660
Detonatorで爆発させる勉強会をした報告
yandod
0
2.4k
Mecanimでアニメーション - Shimokita.Unity
yandod
0
720
パリの街をUnityで駆ける
yandod
1
3.4k
Other Decks in Programming
See All in Programming
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
3
850
offers_20241022_imakiire.pdf
imakurusu
2
370
Why Spring Matters to Jakarta EE - and Vice Versa
ivargrimstad
0
1.2k
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
370
Piniaの現状と今後
waka292
5
1.5k
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.6k
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
500
色々なIaCツールを実際に触って比較してみる
iriikeita
0
290
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.4k
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
200
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
270
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Done Done
chrislema
181
16k
Docker and Python
trallard
40
3.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
The Power of CSS Pseudo Elements
geoffreycrofte
72
5.3k
How STYLIGHT went responsive
nonsquared
95
5.2k
Designing Experiences People Love
moore
138
23k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Invisible Side of Design
smashingmag
297
50k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
BBQ
matthewcrist
85
9.3k
Transcript
ॳΊͯͷ$IFGͷڭࣨ &OHJOF:BSE.FFUVQ ඇΠϯϑϥΤϯδχΞͰग़དྷͨ
ZBOEP
"84 $IFG αϙʔτ
&OHJOF:BSE-PDBM ͋ͳͨͷPC Engine Yard Local Engine Yard Cloud Your App
Your App PC্Ͱ։ൃ͕ແྉ Ϋϥυͱಉ͡ڥ (VagrantΛแ) γʔϜϨεʹΞϓϦΛσ ϓϩΠʂ
"HFOEB $IFGͱ ηοτΞοϓ Ϩγϐͷهड़ ใͷ୳͠ํ
$IFGͱ
$IFG 3VCZͷγεςϜཧπʔϧ ઃఆϑΝΠϧΛݩʹαʔόΛࣗಈઃఆ 6OJY-JOVY.BD8JOEPXTରԠ ແঈ൛Ͱར༻Մೳ ࠃ֎Ͱٸʹελϯμʔυʹ
*OGSBTUSVDUVSFBT$PEF 2011/2 ΠϯϑϥΛίʔυͰهड़͢Δ ͕࣌౸དྷͨ͠
None
DPPLCPPLΛݩʹઃఆ recipe cookbook 3VCZͰॻ͔ΕͨϨγϐͷू·Γ͕ΫοΫϒοΫ $IFGϨγϐΛݩʹϗετΛࣗಈͰઃఆ͢Δ
$IFGͷߏ తͷϊʔυ܈ ཧ༻αʔό
όϦΤʔγϣϯ )PTUFE$IFG 0QT$PEF͕ϗεςΟϯά͢Δ ϊʔυʹԠͨ͡՝ۚ 1SJWBUF$IFG 'JSFXBMMͰՔಇ͢Δ ༗ঈ൛αϙʔτ͋Γ
1SJDF
8FC6* ࣮ɺͬͨࣄͳ͍Ͱ͢ʜ
DIFGTPMP αʔόʔෆཁͷDIFG ϩʔΧϧ্ͷΫοΫϒοΫΛ࣮ߦՄೳ (6*͑ͳ͍ DIFGTPMPΛΩοΫ͢Δπʔϧଟ͍ FY 7BHSBOU &OHJOF:BSE
·ͣ$IFG4PMPͰ ϨγϐΛͬͨߏஙʹ ׳ΕΔͷ͕٢
ηοτΞοϓ
ηοτΞοϓ 3VCZ 3VCZHFNT TPMPSC OPEFKTPO
3VCZSVCZHFNT $ sudo apt-get install ruby1.8 $ sudo apt-get install
rubygems $ sudo gem install chef $ chef-solo -v Chef: 11.4.0 DIFGTPMPDIFGʹಉࠝ DIFGࣗମBQUHFUͰಋೖՄ
3VCZͷཧҙ
TPMPSC Ұ࣍σΟϨΫτϦͷॴͷઃఆ ΫοΫϒοΫͷύεͷઃఆ FUDDIFGTPMPSC ࣮ߦ࣌ʹଘࡏ͠ͳ͍߹ܯࠂ
TPMPSC file_cache_path "/var/chef-solo" cookbook_path ["/var/chef-solo/cookbooks"] file_cache_path "/var/chef-solo" cookbook_path ["/var/chef-solo/cookbooks", "/var/chef-solo/site-cookbooks"]
ෳࢦఆՄ
OPEFKTPO $IFGαʔό͔Βͷσʔλͷସ ΫοΫϒοΫ͢มΛઃఆ ࣮ߦ͢ΔϨγϐΛࢦఆ͢Δ
OPEFKTPO { "resolver": { "nameservers": [ "10.0.0.1" ], "search":"int.example.com" },
"run_list": [ "recipe[resolver]" ] } { "run_list": [ "recipe[resolver]" ] } ࣮ߦ͍ͨ͠Ϩγϐ
DIFGTPMP
ͭ·Γ ະઃఆͷঢ়ଶ͔ΒͰҙͷΫοΫ ϒοΫΛ࣮ߦग़དྷΔ WBSDIFGDPPLCPPLTIPHF ͷΫοΫϒοΫΛ࣮ߦ͢ΔͳΒ $ sudo chef-solo -o hoge
ςετ࣮ߦ
͜͜·Ͱͷ·ͱΊ TVEPBQUHFUVQEBUF TVEPBQUHFUSVCZSVCZHFNT TVEPHFNJOTUBMMDIFG TVEPLOJGFDPPLCPPLDSFBUFIPHF TVEPDIFGTPMPPIPHF
Ϩγϐͷهड़
Ϩγϐͷهड़ LOJGFίϚϯυ σΟϨΫτϦߏ 3FTPVSDF ެ։͞Ε͍ͯΔΫοΫϒοΫ
LOJGFίϚϯυ DIFGαʔόͱͷ௨৴֤छ࡞ۀΛߦ͏ ΫϥΠΞϯτ DIFGTPMPͰར༻͢Δ߹ΫοΫϒο ΫͷॳظԽ࡞ۀʹ͏ ϓϥάΠϯͰαϒίϚϯυΛ֦ுՄ
αϒίϚϯυ ߦ͋Δϔϧϓ ʢ֮͑ΒΕͳ͍ʣ
ΫοΫϒοΫ࡞ LOJGFDPPLCPPLDSFBUF\OBNF^ WBSDIFGDPPLCPPLTҎԼʹ࡞ $IFGαʔόΛΘͳ͍ͷͰΑ͠ͳʹ (JU)VC4Ͱཧ
σΟϨΫτϦߏ CHANGELOG.md attributes/ files/ metadata.rb recipes/ templates/ README.md definitions/ libraries/
providers/ resources/ ϨγϐΛஔ͘ QMBUGPSNຖʹग़དྷΔ ઃఆϑΝΠϧͷͻͳܗ ϨγϐͰར༻͍ͨ͠มͳͲ
SFDJQFTEFGBVMUSC log “Hello Chef” QMBUGPSNΛؾʹ͠ͳ͍߹
Ϩγϐ 3VCZͰॻ͔ΕͨεΫϦϓτ ෦%4-Λͬͯهड़ 3FTPVSDFͱݺΕΔจ๏ ΈࠐΈͷ3FTPVSDF04ʹґଘ͠ͳ͍ ઃఆ࡞ۀΛఏڙ
Α͘͏ػೳ
SFDJQJFTEFGBVMUSC log "Hello Chef" package "apache2" do action :install end
service "apache2" do action :start end ֤ڥͷύοέʔδཧΛ࣮ߦ
BQBDIFೖͬͨ
BQUHFUͰྑ͘Ͷʁ ୯७ͳύοέʔδಋೖҎ্ͷॲཧ͕ग़ དྷΔͷ͕$IFGͷڧΈ ݻ༗ͷઃఆϑΝΠϧͷઃஔ ύοέʔδؒɺϊʔυؒͷ࿈ಈઃఆ ࣮ߦ࣌ʹใΛऔಘ͢Δػೳ
UFNQMBUFϦιʔε &3#ΛͬͯಈతͳΛૠೖ "QBDIFQIQOHJOYͳͲͷઃఆʹ ϓϥοτϑΥʔϜຖʹࠩ͠ସ͑Մೳ
UFNQMBUFTEFGBVMUUFTUUYUFSC This is Sample File.<br/> <%= node[:platform] %><br/> <%= node[:platform_version]
%> SFDJQFTEFGBVMUSC ଓ template "/var/www/test.txt" do source "test.txt.erb" mode 0644 end
ಈతʹϑΝΠϧΛ࡞
JODMVEF ผͷΫοΫϒοΫΛಡΈࠐΉ طଘͷࣝͷ࠶ར༻ ґଘؔͷఆٛ include_recipe “fuga”
ͦͯ͠ ࣗྗͰهड़ͨ͠ϨγϐΛஷΊ͍ͯ͘ ωοτ্ͷϨγϐΛखͯ͠͠ར༻ *OGSBTUSVDUVSFBTDPEFΛ࣮ݱ
ใͷ୳͠ํ
ެ։͞Ε͍ͯΔϨγϐ ͞·͟·ͳํ๏Ͱ͞·͟·ͳஂମ͕ ΫοΫϒοΫΛެ։͍ͯ͠Δ ϨγϐΛ࠶ར༻͢Δ߹શମͷΞʔ ΩςΫνϟʹେ͖ͳӨڹ
DPNNVOJUZPQTDPEFDPN
(JU)VC্ͷϦιʔε opscode-cookbooks ެࣜΫοΫϒοΫ rightscale/cookbooks_public engineyard/ey-cloud-recipes aws/opsworks-cookbooks ֤ϓϥοτϑΥʔϜ͚ jsierles/chef_cookbooks ͔ͭͯ 37signalsͷϦϙδτϦͩͬͨͷ
4PVSDFΠϯετʔϧΛ࣮
None
3PMF͕࣮͞Ε͍ͯΔ
None
None
ͪΐͬͱมΘͬͨ pivotal/pivotal_workstation Pivotalͷ։ൃऀͷPCΛηοτΞοϓ͢Δ
$ISPNF
.BDͷนࢴΛઃఆ
ڭ܇ ެࣜϨγϐϚϧνϓϥοτϑΥʔϜ 1BB4ܥ͕࣮͞Ε͍ͯΔ ಠࣗʹॻ͘ͳΒܾΊଧͪՄೳ ʮखॱॻʯΛࣗಈԽ͢Δهड़ྗ
࣭ʁ