Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
infra-auto-2014-10-07
Search
rrreeeyyy
October 07, 2014
Technology
1.3k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
infra-auto-2014-10-07
ITインフラ 業務自動化現状確認会
rrreeeyyy
October 07, 2014
More Decks by rrreeeyyy
See All by rrreeeyyy
もう一度考える SRE チームの作り方・育て方 / Rethinking SRE #1: Building and Growing SRE Teams
rrreeeyyy
6
1.3k
Reliability in the Age of AI: Engineering for AI Velocity
rrreeeyyy
0
230
Rethinking Incident Response: Context-Aware AI in Practice - Incident Buddy Edition -
rrreeeyyy
0
290
Rethinking Incident Response: Context-Aware AI in Practice
rrreeeyyy
3
2.6k
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
350
An Efficient Incident Response Training with AI / SRE NEXT 2024 Sponsor Session
rrreeeyyy
1
6.3k
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
4
2.7k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
10
3.1k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
9.1k
Other Decks in Technology
See All in Technology
不可逆な意思決定を避けながら10億超の顧客データを AI Ready にするデータ基盤設計
baseballyama
1
160
FOSS4Gを活用した自治体業務DXの試み
470715
0
120
組み立てて楽しむ AWS Blocks 入門
kmiya84377
0
220
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
560
Datadog の学び方 - あるいは、オブザーバビリティを学ぶとは何か
mananyuki
1
500
AI駆動開発、viviONの1年 ── うまくいったこと・いかなかったこと
vivion
0
270
Deep Data Security 機能解説
oracle4engineer
PRO
2
720
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
550
AI時代だからこそ推したい!Gitコマンド再入門
munakata
0
150
自主式軟體工廠
philipz
0
240
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
0
120
The seven pitfalls of AI (revised version)
ufried
0
290
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
610
From π to Pie charts
rasagy
1
390
Designing Powerful Visuals for Engaging Learning
tmiket
1
600
ラッコキーワード サービス紹介資料
rakko
1
5.2M
Raft: Consensus for Rubyists
vanstee
142
7.7k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
620
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
510
WCS-LA-2024
lcolladotor
0
850
Fireside Chat
paigeccino
43
4.1k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
490
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Transcript
Itamae ͬͯΈͨ YOSHIKAWA Ryota (@rrreeeyyy) 1 ը૾ͷ͓ण࢘৽॓۠ͷ "Ეؙ" ͱ͍͏͓ళͷͰ͢ɻඒຯ͔ͬͨ͠ !
ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 1
ࣗݾհ 4 ٢ ཽଠ (Twitter: @rrreeeyyy → ) 4 ϋʔτϏʔπ(ձ)ͱ͍͏ձࣾͷ৽ଔͰ͢
4 ͱݴ͍ͭͭۈଓ 4 ͙Β͍ʹͳΓ·͢2 4 ۀͷ @koemu ͞Μͱಉ͡෦ॺͰࣗಈԽΞϨίϨ 4 ͏ MSP ͷۀͰαʔόͷࢹɾཧ 2 ֶੜελοϑͱͯ͠ೖࣾͨ͠ͷ͕ 18 ࡀ (େֶ 1 ੜͷ 10 ݄) ͙Β͍Ͱɺࠓֶ෦Λଔۀ͠·ͨ͠ɻ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 2
OSC 2014 Tokyo Fall ͰΓ·͢ 3 3 ಥવͷએେมࣦྱக͠·ͨ͠ɻΑΖ͓͘͠ئ͍͠·͢ɻۓுͯ͠·͢ɻ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ
(2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 3
͓அΓͱँࡑ ITΠϯϑϥ "ۀ"ࣗಈԽݱঢ়֬ೝձͳͷʹ ۀͰ͍ͬͯΔπʔϧͷΛ͠·ͤΜ 4 ۀͷ @koemu ઌੜʹ͓ͤ͠·ͨ͠(దͰ͢ɻ͢Έ·ͤΜɻ) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ
(2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 4
Provisioning Tools ͷ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy)
5
Provisioning Tools ݴ͑Δ͔ͳ 4 Chef 4 Ansible 4 Salticid 4
Puppet 4 SaltStack 4 : ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 6
Popular Chef Ansible ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy)
7
I like... Ansible ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy)
8
Why Ansible? - ΤʔδΣϯτϨεʂ - γϯϓϧʂ - ύϫϑϧʂ 5 ύϫϑϧ͋Μ·Γײͨ͜͡ͱແ͍Ͱ͕͢γϯϓϧͰΤʔδΣϯτϨεͳ࡞Γ͖Ͱ͢
ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 9
and Testing tool is... ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota
(@rrreeeyyy) 10
6 Yes, I like. (͓आΓͯ͠·͢ http://serverspec.org/images/logo.png ) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07)
- YOSHIKAWA Ryota (@rrreeeyyy) 11
Կ͕ى͜Δ͔ 4 Provisioning Tool 4 Ansible (Python) 4 Testing Tool
4 Serverspec (Ruby) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 12
! 99 ݴޠ͕౷Ұ͞Ε͓ͯΒͣɺvirtualenv, bundler ͷπʔϧΛ֮͑ͨΓ ansible ίϚϯυ bundle exec rake
spec ͷίϚϯυΛ͍֮͑ͯΔ࣌ͷإ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 13
Itamae 7 ը૾ http://bokete.jp/odai/340329 ͔Β͓आΓ͓ͯ͠Γ·͕͢ ͋Γ·ͨ͠Β͝࿈བྷԼ͍͞ɻ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) -
YOSHIKAWA Ryota (@rrreeeyyy) 14
Itamae 4 https://github.com/ryotarai/itamae (@ryot_a_rai) 4 https://speakerdeck.com/ryotarai/itamae-infra-as- code-xian-zhuang-que-ren-hui 4 Infrataster ࡞ͬͯΒͬ͠ΌΔํ
4 ઌिͷ Infra as Code ݱঢ়֬ೝձͰϓϨθϯ͞Εͨ (ׂͱલ͔Β͋ͬͨͷͰউखʹͬͯͨ) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 15
Կ͕͍͍ͷ 4 ΤʔδΣϯτϨε 4 γϯϓϧ 4 Ruby DSL (not YAML!)
like a Chef 8 4 specinfra(serverspec ͷ core)ͷ্Ͱཱ 4 Ϩγϐ͕ gem ͰཧͰ͖Δ (Berkshelf ཁΒͣ) 8 Not compatible. ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 16
Կ͕͍͍ͷ 4 ႈ 4 --dry-run 4 node attributes json
Ͱཧ 9 4 : 9 yaml Ͱཧ͍ͨ͠ؾ࣋ͪ͋Δ(ग़དྷΔͷ͔ͳʁ) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 17
ී௨ͷྫ package 'httpd' do action :install end template '/etc/httpd/httpd.conf' do
source 'httpd.conf.erb' variables(maxclients: 256) end itamae execute -j node.json -h 192.168.0.1 -p 22 -u yoshikawa -i ~/.ssh/id_rsa recipe.rb ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 18
࣮ߦྫ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 19
خ͍͠ࣄ 4 Ruby DSL ͕ॻ͖͍͢10 4 ςετͱϓϩϏδϣχϯάͰݴޠ͕ἧ͏ 4 ྫ͑ Rake
λεΫͰ ɹϓϩϏδϣχϯάˠςετ͕Ұؾʹग़དྷΔ 10 ݸਓͷײͰ͢ɻͨ·ͨ· Ruby ͕͖ͳͷͰɻ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 20
࣮ࡍͷྫ(Properties) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 21
{ "db-01": { "roles": ["common", "db"], "private_key": "~/.ssh/yoshikawa-test_rsa", "ssh_port": 22,
"server_id": 1 }, "web-01": { "roles": ["web", "common"], "domain": "rrreeeyyy.com" } } ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 22
࣮ࡍͷྫ(Rakefile) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 23
require 'rake' require 'json' require 'rspec/core/rake_task' properties_file = 'properties.json' properties
= JSON.parse(File.read(properties_file)) properties.keys.each do |key| desc "Run provision to #{key}" namespace :itamae do desc "Run itamae to #{key}" task key.split('.')[0] do command = "bundle exec itamae ssh" command << " -h #{key}" command << " -i #{properties[key]['private_key']}" command << " -p #{properties[key]['ssh_port']}" command << " -j #{properties_file}" properties[key]['roles'].each {|role| command << " provision/#{role}/#{role}.rb"} puts command system command end end namespace :serverspec do desc "Run serverspec to #{key}" RSpec::Core::RakeTask.new(key.split('.')[0].to_sym) do |t| ENV['TARGET_HOST'] = key t.pattern = 'spec/{' + properties[key]['roles'].join(',') + '}/*_spec.rb' end end end 11 https://gist.github.com/rrreeeyyy/84efc2907814c56a2b4a ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 24
ݺͼग़͠ํ bundle exec rake itamae:db-01 ࣍ͷΑ͏ʹ͢ΔͱҰؾʹͰ͖Δ bundle exec rake itamae:db-01
serverspec:db-01 ※ ͪΖΜ Rakefile ͰҰؾʹΔλεΫΛఆٛͯ͠Α͍ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 25
࣮ࡍͷྫ(Directoryߏ) ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 26
# ls Gemfile Rakefile provision vendor Gemfile.lock properties.json spec #
cd provision && tree ├── common │ ├── common.rb │ ├── recipes │ │ ├── dstat.rb │ │ └── ntp.rb │ └── templates │ └── ntp.conf.erb ├── db │ ├── db.rb │ ├── recipes │ │ └── mysql.rb │ └── templates │ └── my.cnf.erb : ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 27
# db/db.rb include_recipe "recipes/mysql.rb" include_recipe "..." : # db/recipes/mysql.rb package
'mysql' do action :install end template '/etc/my.cnf' do action :create source '../templates/my.cnf.erb' variables(host: ENV['TARGET_HOST'], server_id: node[ENV['TARGET_HOST']]['server_id']) end ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 28
͕࣌ؒ͋ΕσϞ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 29
·ͱΊ 4 Itamae ͬͯΈͯͨ 4 RubyDSLɾAgentlessɾSimpleɾlight... Ͱྑ͍πʔϧ 4 Itamae ͱ
Serverspec ΛҰؾʹ࣮ߦ͢ΔΓํ 4 Itamae ͷσΟϨΫτϦߏྫΛհ ITΠϯϑϥ ۀࣗಈԽݱঢ়֬ೝձ (2014/10/07) - YOSHIKAWA Ryota (@rrreeeyyy) 30