Upgrade to Pro — share decks privately, control downloads, hide ads and more …

初めてのChefの教室

Yusuke Ando
February 22, 2013

 初めてのChefの教室

2/22に株式会社Engine Yardで開催した非インフラエンジニア向けChef入門講座です。

Yusuke Ando

February 22, 2013
Tweet

More Decks by Yusuke Ando

Other Decks in Programming

Transcript

  1. &OHJOF:BSE-PDBM ͋ͳͨͷPC Engine Yard Local Engine Yard Cloud Your App

    Your App PC্Ͱ։ൃ͕ແྉ Ϋϥ΢υͱಉ͡؀ڥ (VagrantΛ಺แ) γʔϜϨεʹΞϓϦΛσ ϓϩΠʂ
  2. 3VCZSVCZHFNT $ sudo apt-get install ruby1.8 $ sudo apt-get install

    rubygems $ sudo gem install chef $ chef-solo -v Chef: 11.4.0 DIFGTPMP͸DIFGʹಉࠝ DIFGࣗମ΋BQUHFUͰಋೖՄ
  3. OPEFKTPO { "resolver": { "nameservers": [ "10.0.0.1" ], "search":"int.example.com" },

    "run_list": [ "recipe[resolver]" ] } { "run_list": [ "recipe[resolver]" ] } ࣮ߦ͍ͨ͠Ϩγϐ
  4. σΟϨΫτϦߏ੒ CHANGELOG.md attributes/ files/ metadata.rb recipes/ templates/ README.md definitions/ libraries/

    providers/ resources/ ϨγϐΛஔ͘ QMBUGPSNຖʹ΋ग़དྷΔ ઃఆϑΝΠϧͷͻͳܗ ϨγϐͰར༻͍ͨ͠ม਺ͳͲ
  5. SFDJQJFTEFGBVMUSC log "Hello Chef" package "apache2" do action :install end

    service "apache2" do action :start end ֤؀ڥͷύοέʔδ؅ཧΛ࣮ߦ
  6. 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