chef에 등록된 node들은 IP 주소, hostname, kernel module, 언어 버전, 네트워크, 운영체제 정보등과 같은 attribute들을 가지고 있다. chef server는 node의 attribute를 읽어서 그에 맞는 설정 관리를 할 수 있다. 또한 다양한 방법으로 새로운 attributes를 등록해서 사용할 수 있다.
cookbook attributes
Cookbook attribute 파일은 cookbook의 attributes 디렉토리 밑에 위치한다. Node들은 chef code에서 attribute 값들을 사용할 수 있다.
예제
chef node가 등록되면, node의 ohai가 실행되서 attribute 테이블을 만든다. 여기에는 node의 호스트 이름, 노드 이름, recipe 그리고 다양한 시스템 정보들이 들어 있다. knife로 node attribute 정보를 확인하거나 편집할 수 있다.
puts node[:idletime]
puts node[:domain] # 도메인 이름
puts node[:platform] # 운영체제
puts node[:platform_version] # 운영체제 버전
puts node['uptime_seconds'] # 시스템 업타임
puts node['filesystem']['/dev/sda1']['mount'] # /dev/sda1 의 마운트 정보
puts node.name # client node name
Contents
Attribute
cookbook attributes
Node attributes
# knife node edit client01.yundream.com { "name": "client01.yundream.com", "chef_environment": "_default", "run_list": [ "recipe[apache]" ], "normal": { "myname": "yundream", "tags": [ ] } }# knife node edit client01.yundream.com -a { "chef_environment": "_default", "automatic": { "macaddress": "08:00:27:42:4F:E9", "hostname": "localhost", "block_device": { "ram9": { "removable": "0", "size": "32768" }, "ram8": { "removable": "0", "size": "32768" }, "ram7": { "removable": "0", "size": "32768" }, "ram6": { "removable": "0", "size": "32768" }, "ram5": { "removable": "0", "size": "32768" }, "ram4": { "removable": "0", "size": "32768" ...JSON attributes
{ "apache": { "listen_ports": ["81", "8080"] } }Automatic Attributes
히스토리
Recent Posts
Archive Posts
Tags