OSS(Open Source Software)/chef 2014. 4. 7. 21:50

knife는 chef client와 같은 레벨에서 작동하며, chef server API에 접근하기 위한 설정들이 필요하다.

knife 설정파일 이름은 knife.rb 이다.

설정파일에 들어가는 매개 변수는 다음과 같다.

  • node_name : chef-server 연결과 인증을 위한 client 이름
  • client_key : 인증에 사용한 Private key 파일
  • validation_client_name : chef-validator
  • validation_client_key : validation Private key 파일
  • chef_server_url : chef server의 url
  • cache_type : 기본은 'BasicFile'이다. 
    • BaiscFile, Berkeley, Couch, DataMapper, LMC, Memcache, Memory, MonfoDB, Redis, Rufus, S3, SDBM, Tyrant, Xattr, YAML을 지원한다.
  • cache_option : cache 옵션으로 cache_type에 따라서 달라진다.

1. knife client 인증
# mkdir ~/.chef

client의 홈디렉토리에 .chef 디렉토리를 생성한다.

2. chef server에서 인증에 사용할 key 파일 복사

만약 workstation 서버와 chef-server를 다르게 사용할 경우에는 chef-server로부터 key 파일을 복사한다.

# scp root@IP:/etc/chef/validation.pem ~/.chef/

# scp root@IP:/etc/chef/webui.pem ~/.chef/

동일한 서버를 사용할 경우 바로 복사한다.

# cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef/


2. knife 설정파일 생성

# knife configure -i

WARNING: No knife configuration file found

Where should I put the config file? [~/.chef/knife.rb]

Please enter the chef server URL: [http://localhost:4000] http://222.112.182.139:4000

Please enter a clientname for the new client: [root]

Please enter the existing admin clientname: [chef-webui]

Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] webui.pem

Please enter the validation clientname: [chef-validator]

Please enter the location of the validation key: [/etc/chef/validation.pem] validation.pem

Please enter the path to a chef repository (or leave blank):

Creating initial API user...

Created client[root]

Configuration file written to /root/.chef/knife.rb


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

cookbook 생성  (0) 2014.04.10
chef client 설치  (0) 2014.04.10
chef workstation 설정  (0) 2014.04.10
chef server 설치  (0) 2014.04.07
Chef 구성도  (0) 2014.04.07
posted by 구닥다리 엔지니어
: