2011年7月21日木曜日

weblogic cookbookの作成

[root@ip-10-150-183-203 ~]# ls
README.txt  aws  chef-repo  coherence
[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]# 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]# cd files/
[root@ip-10-150-183-203 files]# ls
default
[root@ip-10-150-183-203 files]#
[root@ip-10-150-183-203 files]#
[root@ip-10-150-183-203 files]#
[root@ip-10-150-183-203 files]# pwd
/root/chef-repo/cookbooks/coherence_inst_1/files
[root@ip-10-150-183-203 files]# cd ..
[root@ip-10-150-183-203 coherence_inst_1]# cd ..
[root@ip-10-150-183-203 cookbooks]# dir
README.md  coherence_inst_1
[root@ip-10-150-183-203 cookbooks]# knife cookbook
FATAL: Cannot find sub command for: 'cookbook'
Available cookbook subcommands: (for details, knife SUB-COMMAND --help)

** COOKBOOK COMMANDS **
knife cookbook metadata COOKBOOK (options)
knife cookbook list (options)
knife cookbook create COOKBOOK (options)
knife cookbook bulk delete REGEX (options)
knife cookbook test [COOKBOOKS...] (options)
knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)
knife cookbook download COOKBOOK [VERSION] (options)
knife cookbook upload [COOKBOOKS...] (options)
knife cookbook delete COOKBOOK VERSION (options)
knife cookbook metadata from FILE (options)

[root@ip-10-150-183-203 cookbooks]# knife cookbook create WebLogic
** Creating cookbook WebLogic
** Creating README for cookbook: WebLogic
** Creating metadata for cookbook: WebLogic
[root@ip-10-150-183-203 cookbooks]#
[root@ip-10-150-183-203 cookbooks]# ls
README.md  WebLogic  coherence_inst_1
[root@ip-10-150-183-203 cookbooks]# cd WebLogic/
[root@ip-10-150-183-203 WebLogic]# ls
README.rdoc  definitions  libraries    providers  resources
attributes   files        metadata.rb  recipes    templates
[root@ip-10-150-183-203 WebLogic]#
[root@ip-10-150-183-203 WebLogic]# cd recipes/
[root@ip-10-150-183-203 recipes]# ls
default.rb
[root@ip-10-150-183-203 recipes]# cp default.rb install_10.3.5.rb
[root@ip-10-150-183-203 recipes]# ls
default.rb  install_10.3.5.rb
[root@ip-10-150-183-203 recipes]# vi install_10.3.5.rb
[root@ip-10-150-183-203 recipes]# vi install_10.3.5.rb
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# ls
default.rb  install_10.3.5.rb
[root@ip-10-150-183-203 recipes]# cat install_10.3.5.rb
#
# Cookbook Name:: WebLogic
# Recipe:: default
#
# Copyright 2011, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
execute "download_coherence" do
  command "s3cmd get 1-1-16-1019:wls1035_dev_linux_x86.zip weblogic.zip"
  creates "/home/s3sync/weblogic.zip"
  action :run
end

execute "unzip_weblogic.zip" do
  command "unzip /home/s3sync/weblogic.zip"
  cwd "/root"
  action :run
end


[root@ip-10-150-183-203 recipes]# knife cookbook upload WebLogic
Uploading WebLogic             [0.0.1]
upload complete
[root@ip-10-150-183-203 recipes]#


run listに追加する

[root@ip-10-150-183-203 recipes]# knife node run_list add  demo.example.net2 recipe[WebLogic:: install_10.3.5]
run_list:
    recipe[coherence_inst_1]
    recipe[recipe[WebLogic::]
[root@ip-10-150-183-203 recipes]# knife node run_list add  demo.example.net2 recipe[WebLogic::install_10.3.5]
run_list:
    recipe[coherence_inst_1]
    recipe[recipe[WebLogic::]
    recipe[WebLogic::install_10.3.5]
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# knife node run_list remove  demo.example.net2 recipe[WebLogic::]
run_list:
    recipe[coherence_inst_1]
    recipe[recipe[WebLogic::]
    recipe[WebLogic::install_10.3.5]
[root@ip-10-150-183-203 recipes]# knife node run_list remove  demo.example.net2 recipe[WebLogic:: ]
run_list:
    recipe[coherence_inst_1]
    recipe[recipe[WebLogic::]
    recipe[WebLogic::install_10.3.5]
[root@ip-10-150-183-203 recipes]# knife node run_list remove  demo.example.net2 recipe[recipe[WebLogic::]
run_list:
    recipe[coherence_inst_1]
    recipe[WebLogic::install_10.3.5]
[root@ip-10-150-183-203 recipes]#

0 件のコメント:

コメントを投稿