狠狠撸

狠狠撸Share a Scribd company logo
OPSCODE CHEF
基本編
Japan Chef User Group
Naotaka Jay Hotta
CloudStack Users Osaka 2012
Japan Chef User Group (JCUG)
設立総会: 2012年8月1日


本日の担当者: Naotaka Jay Hotta (@jhotta)


目 的: Opscode Chefの利用を通して
1)   ITインフラの高度な管理とシステムの運用の実現を目指す。
2)   CI, CD 等に実現のためのディプロイメントツールとして高度な知識の知識が、
     一般化するための土壌作りを手伝う。


方 法:

1)   ML:   chef-ja   google groupで検索してください。
2)   HP: Japan chef user Group   facebookで検索してください。
Cloudstack user group meeting in osaka
本日の時間配分
?15分Chefの基本
(対象者:Chef未経験者)

?1分    質疑応答




                 http://www.flickr.com/photos/32299138@N08/5795005774/
Infrastructure
     as
   a Code
世界中のコンピュートインスタンスの
    0.1%を使ったHPCで
     10時間で計算する
Business の
Agilityを上げる
Loosely tied management tools
              enStatus, Scalr, Opscode chef, Sensu,


Storage                                                AWS

Object
                      CloudStack                       IDCF
                                                       KDDI
Storage
                                                        NTT
                                                        Nifty
   File                            Software-            etc..
 systems      Hypervisor
                                Defined Network


                                                         Public
                  Physical Hardware                   cloud service
自動化を含めた、
LibやAPPs等のパーツの、
細かい要件(version)の定義で
再現性の実現
Chef の基本
公式リリース:


Jan 15th, 2009
Cloudstack user group meeting in osaka
“Chef is like a little system
admin robot... you tell it
how you want your system
configured and it will do all
the dirty work.”
- Early Chef Adopter
DevOps業界では、必需品の第3世代
Sever Configuration …
Puppet, cfengineとの違い?


  Those Who are
    not Using!
?   Ruby Internal DSL

?   便利なknife command

?   Apache License 2.0 OSS

?   Communityの活力
Opscode Chef community

? 380+Cookbooks
? Plug-Ins 多数
? Source Code Documentation
? FAQ



? Training
  16,000 Active Users
? 600+ Individual and
  120+ Corporate Contributors
? Global Partner Network

                                http://community.opscode.com/
Cloudstack user group meeting in osaka
初期の顷から、谤别肠颈辫别を公开していた
http://dtosolutions.com/
Cloudstack user group meeting in osaka
http://dtosolutions.com/
Chef-Solo

OSS Chef-server

Private Chef-server

Hosted Chef-server
# chef-solo -c ~/solo.rb 

  -j ~/node.json 

  -r http://www.example.com/chef-solo.tar.gz


               -c, --config CONFIG
               -j, --json-attributes JSON_ATTRIBS
               -r, --recipe-url RECIPE_URL

               *run_listは、json-attributesの中で設定する。
Cloudstack user group meeting in osaka
それぞれのNODEのRoleに合わせた、
 設定内容のリストが呼び出される。

name "webserver"
description "The base role for systems that serve HTTP traffic"
run_list "recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]”
default_attributes "apache2" => { "listen_ports" => [ "80", "443" ] }
override_attributes "apache2" => { "max_children" => "50" }
Cloudstack user group meeting in osaka
コミュニティーレシピーのリポジトリー
Repository                              Description                    Maintainer


https://github.com/opscode-cookbooks    Cookbooks created by Opscode   Opscode



https://github.com/37signals/37s_cook   37 Signals Repository          37 Signals
books

https://github.com/engineyard/ey-       EY Cloud Recipes               Engine Yard
cloud-recipes

https://github.com/cookbooks            Community Curated Cookbooks    “Cookbooks” Organization
knife cloudstack
Knife:
強力なCLI
(コマンドラインインターフェース)
Subcommands built into Knife:
? Bootstrap
? Client
? Cloud Plugins
? Configure
? Cookbook
? Cookbook Site
? Data Bag
? Environment
? Exec
? Node
? Recipe
? Role
? Search
? SSH
? Status
? Tag
Knife Plugins
設置は簡単、
ディレクトリの自由度が高い
? ~/.chef/plugins/knife/

? Cookbookの.chef/plugins/knife/

? Ruby Gem があるchef/knife
有益なCommunity Plugins




  http://wiki.opscode.com/display/chef/Community+Plugins
knife.rb file:

knife[:cloudstack_url] = "http://yourcloudstackserver.com:8080/client/api
knife[:cloudstack_api_key] = "Your CloudStack API Key"
knife[:cloudstack_secret_key] = "Your CloudStack Secret Key"
** CS COMMANDS **

knife cs hosts
knife cs network list (options)
knife cs server create [SERVER_NAME] (options)
knife cs server delete SERVER_NAME [SERVER_NAME ...] (options)
knife cs server list (options)
knife cs server reboot SERVER_NAME [SERVER_NAME ...] (options)
knife cs server start SERVER_NAME [SERVER_NAME ...] (options)
knife cs server stop SERVER_NAME [SERVER_NAME ...] (options)
knife cs service list (options)
knife cs stack create JSON_FILE (options)
knife cs stack delete JSON_FILE (options)
knife cs template list (options)
knife cs zone list (options)
knife.rbで、
Hadoop cluster 構成を指定すると!
"name": "hadoop_cluster_a",
"description": "A small hadoop cluster with hbase",
"version": "1.0",
"environment": "production",
"servers": [
 {
   "name": "zookeeper-a, zookeeper-b, zookeeper-c",
   "description": "Zookeeper nodes",
   "template": "rhel-5.6-base",
   "service": "small",
   "port_rules": "2181",
   "run_list": "role[cluster_a], role[zookeeper_server]",
   "actions": [
     { "knife_ssh": ["role:zookeeper_server", "sudo chef-client"] }
   ]
 },
 {
   "name": "hadoop-master",
   "description": "Hadoop master node",
   "template": "rhel-5.6-base",
   "service": "large",
   "networks": "app-net, storage-net",
   "port_rules": "50070, 50030, 60010",
   "run_list": "role[cluster_a], role[hadoop_master], role[hbase_master]"
 },
 {
   "name": "hadoop-worker-a hadoop-worker-b hadoop-worker-c",
   "description": "Hadoop worker nodes",
   "template": "rhel-5.6-base",
   "service": "medium",
   "port_rules": "50075, 50060, 60030",
   "run_list": "role[cluster_a], role[hadoop_worker], role[hbase_regionserver]",
   "actions": [
     { "knife_ssh": ["role:hadoop_master", "sudo chef-client"] },
     { "http_request": "http://${hadoop-master}:50070/index.jsp" }
   ]
 }
Opscodeと旧cloud.comより、
CloudStack 3.0に対応していると、
ニュースリリ-スされていますが、
CloudStack User会の事務局長A氏の個
人検証環境の強制占拠によって
未だ検証できず!

More Related Content

Cloudstack user group meeting in osaka