OSS(Open Source Software)/chef 2014. 4. 14. 17:27
chef 설치
# rpm -Uvh http://rbel.frameos.org/rbel6
Retrieving http://rbel.frameos.org/rbel6
warning: /var/tmp/rpm-tmp.ZoRc8e: Header V4 DSA/SHA1 Signature, key ID f345be74: NOKEY
Preparing...                ########################################### [100%]
   1:rbel6-release          ########################################### [100%]

# yum install rubygem-chef


리포지터리 생성

# git clone git://github.com/opscode/chef-repo.git

Initialized empty Git repository in /game/chef-repo/.git/

remote: Reusing existing pack: 223, done.

remote: Total 223 (delta 0), reused 0 (delta 0)

Receiving objects: 100% (223/223), 46.09 KiB, done.

Resolving deltas: 100% (56/56), done.


쿡북 생성

# rm -rf cookbooks/

# git clone git://github.com/opscode/cookbooks.git

Initialized empty Git repository in /game/chef-repo/cookbooks/.git/

remote: Reusing existing pack: 18242, done.

remote: Total 18242 (delta 0), reused 0 (delta 0)

Receiving objects: 100% (18242/18242), 9.04 MiB | 2.16 MiB/s, done.

Resolving deltas: 100% (6971/6971), done.


knife 초기화

# knife configure


예제 cookbook 생성

# cd chef-repo

# knife cookbook create hello -o cookbooks

** Creating cookbook hello

** Creating README for cookbook: hello

** Creating metadata for cookbook: hello


레시피 편집

# vim cookbooks/hello/recipes/default.rb


log "Hello, Chef!"


chef solo 실행 시 사용할 레시피를 포함하는 JSON 파일 준비

chef-repo/localhost.json

{

        "run_list" : [

                "recipe[hello]"

        ]

}


solo.rb 파일 생성

file_cache_path "/tmp/chef-solo"

cookbook_path ["/game/chef-repo/cookbooks"]


chef-solo 실행

# chef-solo -c solo.rb -j localhost.json

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: *** Chef 0.10.6 ***

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Setting the run_list to ["recipe[hello]"] from JSON

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Run List is [recipe[hello]]

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Run List expands to [hello]

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Starting Chef Run for localhost

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Running start handlers

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Start handlers complete.

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Processing log[Hello, Chef!] action write (hello::default line 9)

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Hello, Chef!

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Chef Run complete in 0.002279 seconds

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Running report handlers

[Mon, 14 Apr 2014 17:25:35 +0900] INFO: Report handlers complete


chef-solo 사용 순서 요약

  • 레시피 생성
  • JSON 파일로 실행할 레시피 지정
  • chef-solo 명령어로 실행


'OSS(Open Source Software) > chef' 카테고리의 다른 글

멱등성이란?  (0) 2014.04.14
chef-solo를 이용한 패키지 설치  (0) 2014.04.14
knife 초기 설정  (0) 2014.04.14
리포지터리(키친), 쿡북, 레시피  (0) 2014.04.14
chef 설치  (0) 2014.04.14
posted by 구닥다리 엔지니어
: