설치 테스트에 사용한 OS는 CentOS 5.4 x86_64이며, VMware ESXi 상의 VM을 하나 만들어서 진행했다.
요구사항
- Chef 설치시 hostname은 반드시 FQDN이어야 한다. hostname -f 결과가 에러가 발생하면 안됨. FQDN 명심!
- ruby >= 1.8.6 (이라고 되어 있으나, 설치 해본 결과로는 1.8.7은 되야 문제가 없었다)
- rubygems >= 1.3.6 (역시, 1.3.7은 되야 문제가 없었다)
- 권한 문제에 신경쓰기 싫어 root 계정으로 진행했다.
RPM ruby 제거 및 관련 의존성 패키지 설치
# yum -y groupremove "Ruby"
# yum -y install zlib*
# yum -y install openssl*
ruby 설치
# cd /usr/local/src
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz
# tar zxvf ruby-1.8.7.tar.gz
# cd ruby-1.8.7
# ./configure
# make
# make install
# ruby --version
ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
rubygems 설치
# cd /usr/local/src
# wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
# tar zxvf rubygems-1.3.7.tgz
# cd rubygems-1.3.7
# ruby setup.rb
RubyGems 1.3.7 installed
=== 1.3.7 / 2010-05-13
NOTE:
http://rubygems.org is now the default source for downloading gems.
You may have sources set via ~/.gemrc, so you should replace
http://gems.rubyforge.org with http://rubygems.org
http://gems.rubyforge.org will continue to work for the forseeable future.
New features:
* `gem` commands
* `gem install` and `gem fetch` now report alternate platforms when a
matching one couldn't be found.
* `gem contents` --prefix is now the default as specified in --help. Bug
#27211 by Mamoru Tasaka.
* `gem fetch` can fetch of old versions again. Bug #27960 by Eric Hankins.
* `gem query` and friends output now lists platforms. Bug #27856 by Greg
Hazel.
* `gem server` now allows specification of multiple gem dirs for
documentation. Bug #27573 by Yuki Sonoda.
* `gem unpack` can unpack gems again. Bug #27872 by Timothy Jones.
* `gem unpack` now unpacks remote gems.
* --user-install is no longer the default. If you really liked it, see
Gem::ConfigFile to learn how to set it by default. (This change was made
in 1.3.6)
* RubyGems now has platform support for IronRuby. Patch #27951 by Will Green.
Bug fixes:
* Require rubygems/custom_require if --disable-gem was set. Bug #27700 by
Roger Pack.
* RubyGems now protects against exceptions being raised by plugins.
* rubygems/builder now requires user_interaction. Ruby Bug #1040 by Phillip
Toland.
* Gem::Dependency support #version_requirements= with a warning. Fix for old
Rails versions. Bug #27868 by Wei Jen Lu.
* Gem::PackageTask depends on the package dir like the other rake package
tasks so dependencies can be hooked up correctly.
------------------------------------------------------------------------------
RubyGems installed the following executables:
/usr/local/bin/gemgem 환경 변수 확인
# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
OPScode 소스 추가
# gem sources -a http://gems.opscode.com
http://gems.opscode.com added to sources
# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/", "http://gems.opscode.com"]
- REMOTE SOURCES:
- http://rubygems.org/
- http://gems.opscode.comchef 설치
# gem install chef
Building native extensions. This could take a while...
Successfully installed mixlib-config-1.1.2
Successfully installed mixlib-cli-1.2.0
Successfully installed mixlib-log-1.3.0
Successfully installed mixlib-authentication-1.1.4
Successfully installed json-1.4.6
Successfully installed extlib-0.9.15
Successfully installed systemu-1.2.0
Successfully installed ohai-0.5.8
Successfully installed mime-types-1.16
Successfully installed rest-client-1.6.1
Successfully installed bunny-0.6.0
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed moneta-0.6.0
Successfully installed highline-1.6.1
Successfully installed uuidtools-2.1.2
Successfully installed chef-0.9.14
17 gems installed
Installing ri documentation for mixlib-config-1.1.2...
Installing ri documentation for mixlib-cli-1.2.0...
Unrecognized directive 'short' in README.rdoc
Unrecognized directive 'long' in README.rdoc
Unrecognized directive 'description' in README.rdoc
Unrecognized directive 'default' in README.rdoc
Unrecognized directive 'required' in README.rdoc
Unrecognized directive 'on' in README.rdoc
Unrecognized directive 'boolean' in README.rdoc
Unrecognized directive 'show_options' in README.rdoc
Unrecognized directive 'exit' in README.rdoc
Unrecognized directive 'proc' in README.rdoc
Installing ri documentation for mixlib-log-1.3.0...
Installing ri documentation for mixlib-authentication-1.1.4...
Installing ri documentation for json-1.4.6...
Installing ri documentation for extlib-0.9.15...
Installing ri documentation for systemu-1.2.0...
Installing ri documentation for ohai-0.5.8...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for rest-client-1.6.1...
Installing ri documentation for bunny-0.6.0...
Installing ri documentation for abstract-1.0.0...
Installing ri documentation for erubis-2.6.6...
Installing ri documentation for moneta-0.6.0...
Installing ri documentation for highline-1.6.1...
Installing ri documentation for uuidtools-2.1.2...
Installing ri documentation for chef-0.9.14...
Installing RDoc documentation for mixlib-config-1.1.2...
Installing RDoc documentation for mixlib-cli-1.2.0...
Unrecognized directive 'short' in README.rdoc
Unrecognized directive 'long' in README.rdoc
Unrecognized directive 'description' in README.rdoc
Unrecognized directive 'default' in README.rdoc
Unrecognized directive 'required' in README.rdoc
Unrecognized directive 'on' in README.rdoc
Unrecognized directive 'boolean' in README.rdoc
Unrecognized directive 'show_options' in README.rdoc
Unrecognized directive 'exit' in README.rdoc
Unrecognized directive 'proc' in README.rdoc
Installing RDoc documentation for mixlib-log-1.3.0...
Installing RDoc documentation for mixlib-authentication-1.1.4...
Installing RDoc documentation for json-1.4.6...
Installing RDoc documentation for extlib-0.9.15...
Installing RDoc documentation for systemu-1.2.0...
Installing RDoc documentation for ohai-0.5.8...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for rest-client-1.6.1...
Installing RDoc documentation for bunny-0.6.0...
Installing RDoc documentation for abstract-1.0.0...
Installing RDoc documentation for erubis-2.6.6...
Installing RDoc documentation for moneta-0.6.0...
Installing RDoc documentation for highline-1.6.1...
Installing RDoc documentation for uuidtools-2.1.2...
Installing RDoc documentation for chef-0.9.14...cookboot 설치
(git가 필요해 EPEL을 통해 git를 설치 해준다.)
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# yum -y install git
# mkdir /root/chef
# cd /root/chef
# git clone http://github.com/opscode/chef-repo.git
Cloning into chef-repo...
remote: Counting objects: 173, done.
remote: Compressing objects: 100% (106/106), done.
remote: Total 173 (delta 62), reused 138 (delta 40)
Receiving objects: 100% (173/173), 27.25 KiB, done.
Resolving deltas: 100% (62/62), done.
# ls -al
total 16
drwxr-xr-x 3 root root 4096 Mar 27 03:19 .
drwxr-x--- 20 root root 4096 Mar 27 03:16 ..
drwxr-xr-x 130 root root 4096 Mar 27 03:19 chef-repo# ls -al chef-repo
total 44
drwxr-xr-x 8 root root 4096 Mar 27 03:35 .
drwxr-xr-x 3 root root 4096 Mar 27 03:35 ..
drwxr-xr-x 2 root root 4096 Mar 27 03:35 certificates
drwxr-xr-x 2 root root 4096 Mar 27 03:35 config
drwxr-xr-x 2 root root 4096 Mar 27 03:35 cookbooks
drwxr-xr-x 2 root root 4096 Mar 27 03:35 data_bags
drwxr-xr-x 8 root root 4096 Mar 27 03:35 .git
-rw-r--r-- 1 root root 18 Mar 27 03:35 .gitignore
-rw-r--r-- 1 root root 2171 Mar 27 03:35 Rakefile
-rw-r--r-- 1 root root 3521 Mar 27 03:35 README.md
drwxr-xr-x 2 root root 4096 Mar 27 03:35 roles
# ls -al chef-repo/cookbooks
total 12
drwxr-xr-x 2 root root 4096 Mar 27 03:35 .
drwxr-xr-x 8 root root 4096 Mar 27 03:35 ..
-rw-r--r-- 1 root root 2930 Mar 27 03:35 README.md# cd chef-repo
# rm -rf cookbooks
# git clone git://github.com/opscode/cookbooks.git
# ls -al cookbooks/
total 552
drwxr-xr-x 130 root root 4096 Mar 27 03:44 .
drwxr-xr-x 8 root root 4096 Mar 27 03:44 ..
drwxr-xr-x 5 root root 4096 Mar 27 03:44 activemq
drwxr-xr-x 3 root root 4096 Mar 27 03:44 ant
drwxr-xr-x 7 root root 4096 Mar 27 03:44 apache2
drwxr-xr-x 4 root root 4096 Mar 27 03:44 apparmor
drwxr-xr-x 5 root root 4096 Mar 27 03:44 application
drwxr-xr-x 6 root root 4096 Mar 27 03:44 apt
drwxr-xr-x 6 root root 4096 Mar 27 03:44 aws
drwxr-xr-x 6 root root 4096 Mar 27 03:44 bluepill
drwxr-xr-x 3 root root 4096 Mar 27 03:44 boost
drwxr-xr-x 3 root root 4096 Mar 27 03:44 build-essential
drwxr-xr-x 4 root root 4096 Mar 27 03:44 capistrano
drwxr-xr-x 5 root root 4096 Mar 27 03:44 chef
drwxr-xr-x 5 root root 4096 Mar 27 03:44 chef-client
drwxr-xr-x 7 root root 4096 Mar 27 03:44 cloudkick
-rw-r--r-- 1 root root 408 Mar 27 03:44 CONTRIBUTING
drwxr-xr-x 6 root root 4096 Mar 27 03:44 couchdb
drwxr-xr-x 3 root root 4096 Mar 27 03:44 cron
drwxr-xr-x 7 root root 4096 Mar 27 03:44 daemontools
drwxr-xr-x 4 root root 4096 Mar 27 03:44 database
drwxr-xr-x 4 root root 4096 Mar 27 03:44 django
drwxr-xr-x 7 root root 4096 Mar 27 03:44 djbdns
drwxr-xr-x 6 root root 4096 Mar 27 03:44 dmg
drwxr-xr-x 3 root root 4096 Mar 27 03:44 drbd
drwxr-xr-x 6 root root 4096 Mar 27 03:44 dynect
drwxr-xr-x 5 root root 4096 Mar 27 03:44 dynomite
drwxr-xr-x 4 root root 4096 Mar 27 03:44 ec2
drwxr-xr-x 3 root root 4096 Mar 27 03:44 emacs
drwxr-xr-x 4 root root 4096 Mar 27 03:44 erlang
drwxr-xr-x 4 root root 4096 Mar 27 03:44 fail2ban
drwxr-xr-x 6 root root 4096 Mar 27 03:44 gems
drwxr-xr-x 4 root root 4096 Mar 27 03:44 git
drwxr-xr-x 8 root root 4096 Mar 27 03:44 .git
-rw-r--r-- 1 root root 38 Mar 27 03:44 .gitignore
drwxr-xr-x 5 root root 4096 Mar 27 03:44 glassfish
drwxr-xr-x 4 root root 4096 Mar 27 03:44 gnu_parallel
drwxr-xr-x 5 root root 4096 Mar 27 03:44 god
drwxr-xr-x 7 root root 4096 Mar 27 03:44 gunicorn
drwxr-xr-x 4 root root 4096 Mar 27 03:44 hadoop
drwxr-xr-x 5 root root 4096 Mar 27 03:44 haproxy
drwxr-xr-x 3 root root 4096 Mar 27 03:44 heartbeat
drwxr-xr-x 3 root root 4096 Mar 27 03:44 imagemagick
drwxr-xr-x 4 root root 4096 Mar 27 03:44 instiki
drwxr-xr-x 6 root root 4096 Mar 27 03:44 iptables
drwxr-xr-x 5 root root 4096 Mar 27 03:44 java
drwxr-xr-x 3 root root 4096 Mar 27 03:44 java_sun
drwxr-xr-x 5 root root 4096 Mar 27 03:44 jetty
drwxr-xr-x 6 root root 4096 Mar 27 03:44 jira
drwxr-xr-x 5 root root 4096 Mar 27 03:44 jpackage
drwxr-xr-x 4 root root 4096 Mar 27 03:44 keepalived
drwxr-xr-x 5 root root 4096 Mar 27 03:44 kickstart
-rw-r--r-- 1 root root 10850 Mar 27 03:44 LICENSE
drwxr-xr-x 5 root root 4096 Mar 27 03:44 logrotate
drwxr-xr-x 3 root root 4096 Mar 27 03:44 logwatch
drwxr-xr-x 3 root root 4096 Mar 27 03:44 lvm
drwxr-xr-x 3 root root 4096 Mar 27 03:44 man
drwxr-xr-x 5 root root 4096 Mar 27 03:44 maradns
drwxr-xr-x 3 root root 4096 Mar 27 03:44 maven
drwxr-xr-x 6 root root 4096 Mar 27 03:44 memcached
drwxr-xr-x 3 root root 4096 Mar 27 03:44 mercurial
drwxr-xr-x 7 root root 4096 Mar 27 03:44 munin
drwxr-xr-x 8 root root 4096 Mar 27 03:44 mysql
drwxr-xr-x 8 root root 4096 Mar 27 03:44 nagios
drwxr-xr-x 3 root root 4096 Mar 27 03:44 nanite
drwxr-xr-x 7 root root 4096 Mar 27 03:44 nginx
-rw-r--r-- 1 root root 999 Mar 27 03:44 NOTICE
drwxr-xr-x 3 root root 4096 Mar 27 03:44 nscd
drwxr-xr-x 5 root root 4096 Mar 27 03:44 ntp
drwxr-xr-x 5 root root 4096 Mar 27 03:44 ohai
drwxr-xr-x 5 root root 4096 Mar 27 03:44 one-shot
drwxr-xr-x 6 root root 4096 Mar 27 03:44 openldap
drwxr-xr-x 4 root root 4096 Mar 27 03:44 openssh
drwxr-xr-x 4 root root 4096 Mar 27 03:44 openssl
drwxr-xr-x 5 root root 4096 Mar 27 03:44 openvpn
drwxr-xr-x 5 root root 4096 Mar 27 03:44 ossec
drwxr-xr-x 5 root root 4096 Mar 27 03:44 packages
drwxr-xr-x 5 root root 4096 Mar 27 03:44 pacman
drwxr-xr-x 5 root root 4096 Mar 27 03:44 passenger_apache2
drwxr-xr-x 5 root root 4096 Mar 27 03:44 passenger_enterprise
drwxr-xr-x 7 root root 4096 Mar 27 03:44 pdns
drwxr-xr-x 5 root root 4096 Mar 27 03:44 perl
drwxr-xr-x 7 root root 4096 Mar 27 03:44 php
drwxr-xr-x 5 root root 4096 Mar 27 03:44 postfix
drwxr-xr-x 5 root root 4096 Mar 27 03:44 postgresql
drwxr-xr-x 5 root root 4096 Mar 27 03:44 pxe_dust
drwxr-xr-x 6 root root 4096 Mar 27 03:44 python
drwxr-xr-x 5 root root 4096 Mar 27 03:44 quick_start
drwxr-xr-x 5 root root 4096 Mar 27 03:44 rabbitmq
drwxr-xr-x 3 root root 4096 Mar 27 03:44 rabbitmq_chef
drwxr-xr-x 6 root root 4096 Mar 27 03:44 radiant
drwxr-xr-x 5 root root 4096 Mar 27 03:44 rails
drwxr-xr-x 4 root root 4096 Mar 27 03:44 rails_enterprise
-rw-r--r-- 1 root root 1227 Mar 27 03:44 Rakefile
-rw-r--r-- 1 root root 659 Mar 27 03:44 README
drwxr-xr-x 5 root root 4096 Mar 27 03:44 redmine
drwxr-xr-x 4 root root 4096 Mar 27 03:44 reprepro
drwxr-xr-x 5 root root 4096 Mar 27 03:44 resolver
drwxr-xr-x 8 root root 4096 Mar 27 03:44 riak
drwxr-xr-x 3 root root 4096 Mar 27 03:44 rsync
drwxr-xr-x 6 root root 4096 Mar 27 03:44 rsyslog
drwxr-xr-x 4 root root 4096 Mar 27 03:44 ruby
drwxr-xr-x 5 root root 4096 Mar 27 03:44 ruby_enterprise
drwxr-xr-x 3 root root 4096 Mar 27 03:44 rubygems
drwxr-xr-x 7 root root 4096 Mar 27 03:44 runit
drwxr-xr-x 3 root root 4096 Mar 27 03:44 rush
drwxr-xr-x 7 root root 4096 Mar 27 03:44 samba
drwxr-xr-x 7 root root 4096 Mar 27 03:44 sbuild
drwxr-xr-x 3 root root 4096 Mar 27 03:44 screen
drwxr-xr-x 5 root root 4096 Mar 27 03:44 snort
drwxr-xr-x 7 root root 4096 Mar 27 03:44 solr
drwxr-xr-x 3 root root 4096 Mar 27 03:44 sqlite
drwxr-xr-x 4 root root 4096 Mar 27 03:44 ssh_known_hosts
drwxr-xr-x 4 root root 4096 Mar 27 03:44 stompserver
drwxr-xr-x 5 root root 4096 Mar 27 03:44 subversion
drwxr-xr-x 5 root root 4096 Mar 27 03:44 sudo
drwxr-xr-x 4 root root 4096 Mar 27 03:44 teamspeak
drwxr-xr-x 5 root root 4096 Mar 27 03:44 teamspeak3
drwxr-xr-x 3 root root 4096 Mar 27 03:44 thrift
drwxr-xr-x 3 root root 4096 Mar 27 03:44 tmux
drwxr-xr-x 5 root root 4096 Mar 27 03:44 tomcat
drwxr-xr-x 8 root root 4096 Mar 27 03:44 tomcat6
drwxr-xr-x 5 root root 4096 Mar 27 03:44 trac
drwxr-xr-x 8 root root 4096 Mar 27 03:44 transmission
drwxr-xr-x 5 root root 4096 Mar 27 03:44 ubuntu
drwxr-xr-x 4 root root 4096 Mar 27 03:44 ucspi-tcp
drwxr-xr-x 5 root root 4096 Mar 27 03:44 unicorn
drwxr-xr-x 4 root root 4096 Mar 27 03:44 users
drwxr-xr-x 5 root root 4096 Mar 27 03:44 varnish
drwxr-xr-x 4 root root 4096 Mar 27 03:44 vim
drwxr-xr-x 5 root root 4096 Mar 27 03:44 wordpress
drwxr-xr-x 3 root root 4096 Mar 27 03:44 xfs
drwxr-xr-x 3 root root 4096 Mar 27 03:44 xml
drwxr-xr-x 8 root root 4096 Mar 27 03:44 zenoss
drwxr-xr-x 3 root root 4096 Mar 27 03:44 zlib
drwxr-xr-x 3 root root 4096 Mar 27 03:44 zsh
chef-solo 설정 파일 작성
# cat /root/chef/solo.rb
cookbook_path "/root/chef/chef-repo/cookbooks"
이제 Chef-Solo설치는 완료다.(빠진게 있었던가 ㅡㅡ?? 아무튼.... 잘안되면 지적질 댓글을....)
그럼, cookbook에 있는 테스트용 Recipe를 하나 시연 해보고 내용도 간략히 살펴보자.
실행할 Recipe는 "quick_start"라는 것으로, Chef를 통해 실행하게 되면, 실행된 노드의 /tmp디렉토리에 "If a tree falls in the forest..."라는 TEXT내용을 가진 deep_thought.txt 파일을 생성시킨다. 해보자. 진짜 되는지...
json 파일을 만든다. 이파일은 Chef를 통해, 수행할 작업(Recipe)을 정의 하는것 같다.
# cat /root/chef/node.json
{
"run_list": [ "recipe[quick_start]" ]
}Recpit 수행
# chef-solo -c /root/chef/solo.rb -j /root/chef/node.json
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: Setting the run_list to ["recipe[quick_start]"] from JSON
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: Starting Chef Run (Version 0.9.14)
[Sun, 27 Mar 2011 03:46:09 +0900] WARN: Missing gem 'mysql'
[Sun, 27 Mar 2011 03:46:09 +0900] WARN: Missing gem 'right_aws'
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: Writing updated content for template[/tmp/deep_thought.txt] to /tmp/deep_thought.txt
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: Chef Run complete in 0.305653 seconds
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: cleaning the checksum cache
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: Running report handlers
[Sun, 27 Mar 2011 03:46:09 +0900] INFO: Report handlers completeRecpie 수행 결과 확인
# ls -al /tmp/
total 96
drwxrwxrwt 15 root root 4096 Mar 27 03:46 .
drwxr-xr-x 23 root root 4096 Mar 27 02:27 ..
-rw------- 1 root root 54 Mar 27 03:46 deep_thought.txt
drwx------ 3 root root 4096 Mar 27 02:28 gconfd-root
-rw------- 1 root root 66 Mar 27 02:28 .gdmSCQWSV
srw-rw-rw- 1 root root 0 Mar 27 02:28 .gdm_socket
drwxrwxrwt 2 root root 4096 Mar 27 02:28 .ICE-unix
drwx------ 2 root root 4096 Mar 27 02:28 keyring-lh8Uxr
srwxr-xr-x 1 root root 0 Mar 27 02:28 mapping-root
drwx------ 2 root root 4096 Mar 27 02:28 orbit-root
-rw------- 1 root root 1024 Oct 23 2009 .rnd
-rw-r--r-- 1 root root 5 Mar 27 03:28 scim-bridge-0.3.0.lockfile-0@localhost:0.0
srwxr-xr-x 1 root root 0 Mar 27 02:28 scim-bridge-0.3.0.socket-0@localhost:0.0
srw------- 1 root root 0 Mar 27 02:28 scim-helper-manager-socket-root
srw------- 1 root root 0 Mar 27 02:28 scim-panel-socket:0-root
srw------- 1 root root 0 Mar 27 02:28 scim-socket-frontend-root
drwx------ 2 root root 4096 Mar 27 02:28 ssh-wCRkwr3275
drwx------ 2 root root 4096 Mar 27 02:28 virtual-root.BcUGAR
drwxr-xr-x 2 root root 4096 Oct 23 2009 vmware-config0
drwxr-xr-x 2 root root 4096 Oct 23 2009 vmware-config1
drwxr-xr-x 2 root root 4096 Dec 17 2009 vmware-config2
drwxr-xr-x 2 root root 4096 Jul 9 2010 vmware-config3
drwxrwxrwt 3 root root 4096 Oct 23 2009 VMwareDnD
drwx------ 2 root root 4096 Mar 27 02:28 vmware-root
-r--r--r-- 1 root root 11 Mar 27 02:28 .X0-lock
drwxrwxrwt 2 root root 4096 Mar 27 02:28 .X11-unix
# cat /tmp/deep_thought.txt
Todays deep thought: If a tree falls in the forest...
[Recipe 분석]
수행했던 Recipe 디렉토리로 이동
# cd /root/chef/chef-repo/cookbooks/quick_start/
# ls -al
total 28
drwxr-xr-x 5 root root 4096 Mar 27 03:44 .
drwxr-xr-x 130 root root 4096 Mar 27 03:44 ..
drwxr-xr-x 2 root root 4096 Mar 27 03:44 attributes
-rw-r--r-- 1 root root 1186 Mar 27 03:44 metadata.json
-rw-r--r-- 1 root root 535 Mar 27 03:44 metadata.rb
drwxr-xr-x 2 root root 4096 Mar 27 03:44 recipes
drwxr-xr-x 3 root root 4096 Mar 27 03:44 templates중요한 것은 recipes이고, 나머지는 이 recipes에 정의된 작업이 수행되는데 필요한 정보를 담고 있다.
(template, recpites, attributes는 어떤 Recipe든지 default.rb 파일이 가장 기본이며, 먼저 읽혀지는듯 함)
# cat recipes/default.rb
template "/tmp/deep_thought.txt" do
source "deep_thought.txt.erb"
variables :deep_thought => node[:deep_thought]
action :create
end# cat attributes/default.rb
deep_thought "If a tree falls in the forest..."
# cat templates/default/deep_thought.txt.erb
Todays deep thought: <%= @deep_thought %>
여기서는 quick_start라는 Recipe를 수행하였고, 그 Recipe에는 보는 바와 같은 템플릿 하나가 등록되어 있다.
내용을 보면 대충 이해가 되리라 본다. action이 create이니 /tmp/deep_thought.txt를 생성한다는 것 같고, source는 templates/default/deep_thought.txt.erb파일을 가져다가 생성한다~ 뭐 그런... variables는 source파일을 바탕으로 생성하되, source파일 내의 deep_thought변수를 attributes/default.rb에서 정의된 값으로 바꾸어라는 그런... (이해가 안될지도 모른다. 내 설명이 엄청 저질ㅡㅡ;;이라 그런 것이니, 자책마시길...)
대충, 설치부터 간단한 샘플예제 수행까지 정상적이니 마무리 해야 겠다. 물론 더 난이도 높은 Recipe를 수행할때면,러가 뜨거나, Cookbook/Recipe에 대한 허접한 이해도로 인해, 엄청~ 삽질하겠지만, 뭐 첫술에 배부를수는 없지 않나~ 이것부터 차근차근 해두면, 곧 Chef Server/Client로 맘대로 요리(?)할 수 있지 않을까~~
To be Continue~~~~~~~~
'Cloud > Automation' 카테고리의 다른 글
Puppet Configuration Management Tool (0) | 2012.02.23 |
---|---|
Chef Server/Client (on FrameOS6) (0) | 2011.05.12 |
[시스템 자동화] Install Chef Server/Client on CentOS 5.4 x86_64 ...(폐기) (1) | 2011.04.23 |
[Chef]에 관해 간결하고, 재미있게 잘 작성된 PT자료 (추천문서) (0) | 2011.03.25 |
in Cloud, Infrastructure Automation with Chef (클라우드/자동화) (0) | 2011.03.25 |