参考
http://wiki.opscode.com/display/chef/Cookbooks
[root@ip-10-150-183-203 s3sync]# cd ~
[root@ip-10-150-183-203 ~]# ls
aws chef-repo
[root@ip-10-150-183-203 ~]# cd chef-repo/
[root@ip-10-150-183-203 chef-repo]# ls
README.md certificates config data_bags roles
Rakefile chefignore cookbooks environments
[root@ip-10-150-183-203 chef-repo]# knife cookbook create coherence_inst_1
** Creating cookbook coherence_inst_1
** Creating README for cookbook: coherence_inst_1
** Creating metadata for cookbook: coherence_inst_1
[root@ip-10-150-183-203 chef-repo]# ls
README.md certificates config data_bags roles
Rakefile chefignore cookbooks environments
[root@ip-10-150-183-203 chef-repo]# cd cookbooks/
[root@ip-10-150-183-203 cookbooks]# ls
README.md coherence_inst_1
[root@ip-10-150-183-203 cookbooks]# cd coherence_inst_1/
[root@ip-10-150-183-203 coherence_inst_1]# ls
README.rdoc definitions libraries providers resources
attributes files metadata.rb recipes templates
[root@ip-10-150-183-203 coherence_inst_1]#
[root@ip-10-150-183-203 cookbooks]# ls
README.md coherence_inst_1
[root@ip-10-150-183-203 cookbooks]# cd coherence_inst_1/
[root@ip-10-150-183-203 coherence_inst_1]# ls
README.rdoc definitions libraries providers resources
attributes files metadata.rb recipes templates
[root@ip-10-150-183-203 coherence_inst_1]# cd recipes/
[root@ip-10-150-183-203 recipes]# ls
default.rb
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 cookbooks]# knife cookbook upload coherence_inst_1
Uploading coherence_inst_1 [0.0.1]
upload complete
[root@ip-10-150-183-203 cookbooks]#
[root@ip-10-150-183-203 recipes]# knife cookbook list
chef-client 0.99.5
coherence_inst_1 0.0.1
[root@ip-10-150-183-203 recipes]# knife node list
demo.example.net2
ip-10-146-7-97.ap-northeast-1.compute.internal
[root@ip-10-150-183-203 recipes]# knife node run_list add demo.example.net2 coherence_install_1
run_list: recipe[coherence_install_1]
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# knife node show demo.example.net2
Node Name: demo.example.net2
Environment: _default
FQDN: ip-10-150-183-203.ap-northeast-1.compute.internal
IP: 10.150.183.203
Run List: recipe[coherence_install_1]
Roles:
Recipes
Platform: centos 5.5
[root@ip-10-150-183-203 recipes]# chef-client
[Wed, 20 Jul 2011 07:44:52 -0400] INFO: *** Chef 0.10.2 ***
[Wed, 20 Jul 2011 07:44:53 -0400] INFO: Run List is [recipe[coherence_install_1]]
[Wed, 20 Jul 2011 07:44:53 -0400] INFO: Run List expands to [coherence_install_1]
[Wed, 20 Jul 2011 07:44:53 -0400] INFO: Starting Chef Run for demo.example.net2
[Wed, 20 Jul 2011 07:44:54 -0400] INFO: HTTP Request Returned 412 Precondition Failed: {"non_existent_cookbooks":["coherence_install_1"],"cookbooks_with_no_versions":[],"message":"Run list contains invalid items: no such cookbook coherence_install_1."}
[Wed, 20 Jul 2011 07:44:54 -0400] ERROR: Running exception handlers
[Wed, 20 Jul 2011 07:44:54 -0400] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[Wed, 20 Jul 2011 07:44:54 -0400] ERROR: Exception handlers complete
[Wed, 20 Jul 2011 07:44:54 -0400] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[Wed, 20 Jul 2011 07:44:54 -0400] FATAL: Net::HTTPServerException: 412 "Precondition Failed"
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# knife node run_list remove demo.example.net2 coherence_install_1
run_list: recipe[coherence_install_1]
[root@ip-10-150-183-203 recipes]# knife node run_list add demo.example.net2 coherence_inst_1
run_list:
recipe[coherence_install_1]
recipe[coherence_inst_1]
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# knife node show demo.example.net2
Node Name: demo.example.net2
Environment: _default
FQDN: ip-10-150-183-203.ap-northeast-1.compute.internal
IP: 10.150.183.203
Run List: recipe[coherence_install_1], recipe[coherence_inst_1]
Roles:
Recipes
Platform: centos 5.5
[root@ip-10-150-183-203 recipes]# knife node run_list remove demo.example.net2 coherence_install_1
run_list:
recipe[coherence_install_1]
recipe[coherence_inst_1]
[root@ip-10-150-183-203 recipes]# knife node run_list remove demo.example.net2 coherence_inst_1
run_list:
recipe[coherence_install_1]
recipe[coherence_inst_1]
[root@ip-10-150-183-203 recipes]# knife node run_list remove demo.example.net2
run_list:
recipe[coherence_install_1]
recipe[coherence_inst_1]
[root@ip-10-150-183-203 recipes]# knife node run_list remove demo.example.net
ERROR: The object you are looking for could not be found
Response: Cannot load node demo.example.net
[root@ip-10-150-183-203 recipes]# knife node run_list remove demo.example.net2 recipe[coherence_install_1]
run_list: recipe[coherence_inst_1]
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# chef-client
[Wed, 20 Jul 2011 07:55:44 -0400] INFO: *** Chef 0.10.2 ***
[Wed, 20 Jul 2011 07:55:46 -0400] INFO: Run List is [recipe[coherence_inst_1]]
[Wed, 20 Jul 2011 07:55:46 -0400] INFO: Run List expands to [coherence_inst_1]
[Wed, 20 Jul 2011 07:55:46 -0400] INFO: Starting Chef Run for demo.example.net2
[Wed, 20 Jul 2011 07:55:47 -0400] INFO: Loading cookbooks [coherence_inst_1]
[Wed, 20 Jul 2011 07:55:47 -0400] INFO: Processing execute[download_coherence] action run (coherence_inst_1
::default line 10)
[Wed, 20 Jul 2011 07:55:47 -0400] INFO: execute[download_coherence] sh(s3cmd get 1-1-16-1019:coherence-java
-3.7.0.0b23397.zip coherence.zip)
[Wed, 20 Jul 2011 07:55:48 -0400] INFO: execute[download_coherence] ran successfully
[Wed, 20 Jul 2011 07:55:48 -0400] INFO: Processing execute[unzip_coherence.zip] action run (coherence_inst_
1::default line 16)
[Wed, 20 Jul 2011 07:55:48 -0400] INFO: execute[unzip_coherence.zip] sh(unzip /home/s3sync/coherence.zip)
[Wed, 20 Jul 2011 07:55:49 -0400] INFO: execute[unzip_coherence.zip] ran successfully
[Wed, 20 Jul 2011 07:55:50 -0400] INFO: Chef Run complete in 4.597066 seconds
[Wed, 20 Jul 2011 07:55:50 -0400] INFO: Running report handlers
[Wed, 20 Jul 2011 07:55:50 -0400] INFO: Report handlers complete
[root@ip-10-150-183-203 s3sync]# cd /root
[root@ip-10-150-183-203 ~]# ls
README.txt aws chef-repo coherence
[root@ip-10-150-183-203 ~]# cd coherence/
[root@ip-10-150-183-203 coherence]# ls
bin doc lib product.xml
[root@ip-10-150-183-203 coherence]# ls -ltr
total 16
-rw-r--r-- 1 root root 100 Apr 6 12:31 product.xml
drwxr-xr-x 3 root root 4096 Jul 20 07:55 doc
drwxr-xr-x 2 root root 4096 Jul 20 07:55 bin
drwxr-xr-x 3 root root 4096 Jul 20 07:55 lib
[root@ip-10-150-183-203 coherence]#
OK!
0 件のコメント:
コメントを投稿