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の教室 (v1.2 Chef11対応版)
Search
Yusuke Ando
July 20, 2013
24
12k
初めてのChefの教室 (v1.2 Chef11対応版)
Yusuke Ando
July 20, 2013
Tweet
Share
More Decks by Yusuke Ando
See All by Yusuke Ando
CakePHP3でアプリ開発
yandod
1
330
Shimokita.Unity パーティクルでエフェクト
yandod
0
750
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
710
パリの街をUnityで駆ける
yandod
1
3.4k
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
653
59k
Atom: Resistance is Futile
akmur
261
25k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
Typedesign – Prime Four
hannesfritz
39
2.3k
Thoughts on Productivity
jonyablonski
67
4.2k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Web development in the modern age
philhawksworth
205
10k
The Invisible Side of Design
smashingmag
296
50k
Large-scale JavaScript Application Architecture
addyosmani
509
110k
Testing 201, or: Great Expectations
jmmastey
38
7k
Transcript
ॳΊͯͷ$IFGͷڭࣨ ࠷ͷ%FW0QTπʔϧ
!ZBOEP $BOEZ$BOFQIQ ʮ࠙ձϐβൃΞϓϦʯ
4UBSPOVT
3VCZ/PEFKT1)1ରԠ1BB4 $IFGͰΫϥυΛࣗಈߏங ࣌ؒ༗ਓࢹ 44)TVEPՄೳ͔ͭαϙʔτ༗
"84 $IFG αϙʔτ
None
None
"HFOEB $IFGͱ ηοτΞοϓ Ϩγϐͷهड़ ใͷ୳͠ํ
$IFGͱ
None
$IFG 0QTDPEFࣾͷ$$0"EBN+BDPCࢯ࡞ 3VCZͷγεςϜཧπʔϧ ઃఆϑΝΠϧΛݩʹαʔόΛࣗಈઃఆ 6OJY-JOVY.BD8JOEPXTରԠ ʹຊͰେϒϨΠΫ
ྺ࢙ WFSTJPO WFSTJPO WFSTJPO WFSTJPO WFSTJPO WFSTJPO
*OGSBTUSVDUVSFBT$PEF 2011/2 ΠϯϑϥΛίʔυͰهड़͢Δ ͕࣌౸དྷͨ͠
None
DPPLCPPLΛݩʹઃఆ recipe cookbook 3VCZͰॻ͔ΕͨϨγϐͷू·Γ͕ΫοΫϒοΫ $IFGϨγϐΛݩʹϗετΛࣗಈͰઃఆ͢Δ
Chef Server $IFG$MJFOU4FSWFS ։ൃऀͷPC Workstation Node Cookbook Node DIFGDMJFOU DIFGDMJFOU
"1* Cookbook LOJGF PIBJ PIBJ
ႈੑͱPIBJ ႈੑ Կ࣮ߦͯ͠ಉ݁͡Ռऩଋ͢Δ PIBJ ࣮ߦதͷڥͷใΛऔಘ͢Δ$IFGͷ ϓϥοτϑΥʔϜΛࢧ͑ΔϞδϡʔϧ ౾ ࣝ
όϦΤʔγϣϯ )PTUFE$IFG 0QT$PEF͕ϗεςΟϯά͢Δ ϊʔυʹԠͨ͡՝ۚ 1SJWBUF$IFG 'JSFXBMMͰՔಇ͢Δ ༗ঈ൛αϙʔτ͋Γ
1SJDF
$IFG4FSWFS 044 ࣮ɺͬͨࣄͳ͍Ͱ͢ʜ
)PTUFE$IFG
αʔό༻ҙͱ͔໘ʁ
DIFGTPMP αʔόʔෆཁͷDIFG ϩʔΧϧ্ͷΫοΫϒοΫΛ࣮ߦՄೳ (6*͑ͳ͍ DIFGTPMPΛΩοΫ͢Δπʔϧଟ͍ FY 7BHSBOU &OHJOF:BSE LOJGFTPMP
։ൃऀͷPC Workstation Node $IFG4PMP Node DIFGTPMP Cookbook LOJGF Cookbook DIFGTPMP
Cookbook TTI TTI
ͳΜ͔؆୯ͦ͏ʂ
DIFGTPMPେਓؾ εϚϗͰಡΊΔΑʂ
None
։ൃऀͷPC Workstation Node ,OJGF4PMP Node DIFGTPMP Cookbook LOJGF Cookbook DIFGTPMP
Cookbook TTI TTI LOJGFTPMP͕શ෦ࣗಈͰΔ
·ͣ$IFG4PMPͰ ϨγϐΛͬͨߏஙʹ ׳ΕΔͷ͕٢
ηοτΞοϓ
ηοτΞοϓ 3VCZ 3VCZHFNT TPMPSC OPEFKTPO ࣗಈԽ͞ΕͨͷͰؾʹ͠ͳ͍Ͱྑ͠
*OTUBMM $ curl -L https://www.opscode.com/chef/ install.sh | sudo bash $
chef-solo -v Chef: 11.4.0 PQUʹඞཁͳ3VCZͳͲΛશͯΠϯετʔϧ HFNͰΠϯετʔϧݹ͍ํ๏
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
ςετ࣮ߦ
͜͜·Ͱͷ·ͱΊ DVSM-IUUQTXXXPQTDPEFDPN DIFGJOTUBMMTIcTVEPCBTI TVEPLOJGFDPPLCPPLDSFBUFIPHF TVEPDIFGTPMPPIPHF
ϓϥε ษڧ༻ͳΒ7BHSBOU͕ศར ϩʔΧϧͷ7.ߏஙͷࣗಈԽ $IFG͕ࢼͤΔڥ͕ίϚϯυҰൃ ͋ΒΏΔ։ൃऀඞܞͷπʔϧ
Ϩγϐͷهड़
Ϩγϐͷهड़ 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”
ͦͯ͠ ࣗྗͰهड़ͨ͠ϨγϐΛஷΊ͍ͯ͘ ωοτ্ͷϨγϐΛखͯ͠͠ར༻ GPPEDSJUJDTFSWFSTQFDͳͲͰςετ *OGSBTUSVDUVSFBTDPEFΛ࣮ݱ
&OHJOF:BSEͷ߹
Node Node GitHub engineyard.com Node &OHJOF:BSEͷ߹ DIFGTPMP Cookbook BQQMZ &OHJOF:BSE͕࣮ͨ͠Ϩγϐ
Λ8FCͷૢ࡞Ͱඞཁͳ࣌Ϋϥυʹө ΧελϜϨγϐ Amazon Web Service Windows Azure Verizon/Terremark
ಥવͷ੬ऑੑରԠ
੬ऑੑରԠͳͲΛਵ࣌৴
GitHub ։ൃऀͷPC &OHJOF:BSE-PDBM Cookbook &OHJOF:BSE-PDBM Ϋϥυ্ͱಉҰͷϨγϐͰϩʔΧϧʹ ։ൃڥΛ࡞Δπʔϧ VM DIFGTPMP BQQMZ
7BHSBOU Node DIFGTPMP BQQMZ
׆ൃͳϝϯςφϯε
ใͷ୳͠ํ
ެ։͞Ε͍ͯΔϨγϐ ͞·͟·ͳํ๏Ͱ͞·͟·ͳஂମ͕Ϋ οΫϒοΫΛެ։͍ͯ͠Δ ϨγϐΛ࠶ར༻͢Δ߹શମͷΞʔ ΩςΫνϟʹେ͖ͳӨڹ
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ܥ͕࣮͞Ε͍ͯΔ ಠࣗʹॻ͘ͳΒܾΊଧͪՄೳ ʮखॱॻʯΛࣗಈԽ͢Δهड़ྗ ΫοΫϒοΫͷӡ༻ΛͲ͏͢Δʁ
݁
ؤுΓ͍ͨਓ ؤுΕͳ͍ਓ ͱʹ͔͘Ϩγϐॻ͘ &OHJOF:BSEͲ͏ͧʂ