openstack-chef-repo
                    Tomokazu HIRAI @jedipunkz
                   KDDI Web Communications inc.
13年2月9日土曜日
What is Chef ? #1
             Chef is an open-source systems integration
             framework built specifically for automating the
             cloud.




   * Chef-Server
   * Node
   * WorkStation



13年2月9日土曜日
What is Chef ? #2
                                   Chef-Server
                             (1)                      (3)

       openstack-chef-repo
                                       (2)
                  WorkStation                         Node


         (1) : cookbooks, roles, data_bag, environments 等をアップロード
         (2) : node に対して ‘bootstrap’ 行いデプロイ開始
         (3) : cookbooks, roles 等をダウンロードし chef-client 実行, その後も定期的に実行




13年2月9日土曜日
Why Chef ?
   * 繰り返し実行可能 -> 継続的デプロイ

   * コードに汎用性を持たせるのが容易 -> 資産の活用
       package ‘nginx’

   * API -> アプリ開発が容易




13年2月9日土曜日
Chef for OpenStack
             去年6月のこと...
             We are also working with community
             partners such as Rackspace, Dell, DreamHost
             and HP to help provide a solid basis for deploying
             and managing OpenStack.



     http://www.opscode.com/blog/2012/06/27/chef-for-
                       openstack/



13年2月9日土曜日
今週流れてきたスライド




   http://www.slideshare.net/mattray/chef-11-previewchef-
                       for-openstack

13年2月9日土曜日
Facebook has adopted
             Opscode’s Private Chef




     http://www.datacenterknowledge.com/archives/
   2013/02/04/facebook-uses-retooled-chef-to-manage-
                     infrastructure/
13年2月9日土曜日
openstack-chef-repo
         * chef-repo とは chef の作業ディレクトリ

         * WorkStation 上に配置

         * librarian-chef にて cookbooks (keystone,glance, nova ...) を取得

         * environments(例えば production) で各 cookbook attribute を上書きし
         全体の整合性を取る

         * spiceweasel により knife コマンドを出力・実行




13年2月9日土曜日
ディレクトリ構成
     openstack-chef-repo
     ├── cookbooks
     │   ├── apache2
     │   ├── keystone
     │   ├── glance
     │   ├── .. 略
     ├── environments
     │   └── production.rb
     ├── infrastructure.yml
     ├── roles
     │   ├── allinone.rb
     │   ├── base.rb
     │   ├── glance.rb
     │   ├── horizon-server.rb   * 環境に合わせて修正・追記
     │   ├── .. 略


13年2月9日土曜日
実行準備 #1
             % gem install librarian chef spiceweasel
             % git clone git://github.com/opscode/openstack-chef-repo.git
             % cd openstack-chef-repo
             % librarian-chef update # cookbooks 取得
             % vim environments/production.rb

              ... 略
                "osops_networks" => {
                  "public" => "10.200.8.0/24",
                  "management" => "10.200.8.0/24",
                  "nova" => "10.200.8.0/24"
                },
              ... 略

     * 追記修正


13年2月9日土曜日
実行準備 #2
              % vim infrastructure.yml
              cookbooks:
              - keystone: #used by keystone role
                  version: 2012.1.1
              ... 略
              roles:
                - base:
                - rabbitmq-server:
                - keystone:
              ... 略
              environments:
              - production:

              nodes:
              - 10.200.8.19:
                 run_list: role[allinone]
                 options: -i ~/.ssh/id_rsa -x root -E production
     * 追記修正


13年2月9日土曜日
実行
   % spiceweasel infrastructure.yml # コマンドライン出力
   knife cookbook upload apache2
   knife cookbook upload apt
   ... 略
   knife environment from file production.rb
   knife role from file base.rb
   knife role from file rabbitmq-server.rb
   ... 略
   knife bootstrap 10.200.8.19 -i ~/.ssh/id_rsa -x root -E production -r 'role[allinone]'

   % spiceweasel -e infrastructure.yml # 実行

   ... 10分程度待機

   完成! :D




13年2月9日土曜日
まとめ
      • spiceweasel がインテグレーションしてくれる

      • librarian で cookbooks を取得 # berkshelf に置き換えてほしい

      • environments にて複数環境を管理出来る (staging, testing ..)

      • ‘all in one’ 構成も複数台構成も可能 #複数台は未確認

      • folsom ベースは直ちに開発が始まるそう, 現在は essex ベース

      • chef はインストールツールではなく ‘継続的にデプロイ(運用)す
             るためのフレームワーク’ である


13年2月9日土曜日

Openstack chef-repo

  • 1.
    openstack-chef-repo Tomokazu HIRAI @jedipunkz KDDI Web Communications inc. 13年2月9日土曜日
  • 2.
    What is Chef? #1 Chef is an open-source systems integration framework built specifically for automating the cloud. * Chef-Server * Node * WorkStation 13年2月9日土曜日
  • 3.
    What is Chef? #2 Chef-Server (1) (3) openstack-chef-repo (2) WorkStation Node (1) : cookbooks, roles, data_bag, environments 等をアップロード (2) : node に対して ‘bootstrap’ 行いデプロイ開始 (3) : cookbooks, roles 等をダウンロードし chef-client 実行, その後も定期的に実行 13年2月9日土曜日
  • 4.
    Why Chef ? * 繰り返し実行可能 -> 継続的デプロイ * コードに汎用性を持たせるのが容易 -> 資産の活用 package ‘nginx’ * API -> アプリ開発が容易 13年2月9日土曜日
  • 5.
    Chef for OpenStack 去年6月のこと... We are also working with community partners such as Rackspace, Dell, DreamHost and HP to help provide a solid basis for deploying and managing OpenStack. http://www.opscode.com/blog/2012/06/27/chef-for- openstack/ 13年2月9日土曜日
  • 6.
    今週流れてきたスライド http://www.slideshare.net/mattray/chef-11-previewchef- for-openstack 13年2月9日土曜日
  • 7.
    Facebook has adopted Opscode’s Private Chef http://www.datacenterknowledge.com/archives/ 2013/02/04/facebook-uses-retooled-chef-to-manage- infrastructure/ 13年2月9日土曜日
  • 8.
    openstack-chef-repo * chef-repo とは chef の作業ディレクトリ * WorkStation 上に配置 * librarian-chef にて cookbooks (keystone,glance, nova ...) を取得 * environments(例えば production) で各 cookbook attribute を上書きし 全体の整合性を取る * spiceweasel により knife コマンドを出力・実行 13年2月9日土曜日
  • 9.
    ディレクトリ構成 openstack-chef-repo ├── cookbooks │   ├── apache2 │   ├── keystone │   ├── glance │   ├── .. 略 ├── environments │   └── production.rb ├── infrastructure.yml ├── roles │   ├── allinone.rb │   ├── base.rb │   ├── glance.rb │   ├── horizon-server.rb * 環境に合わせて修正・追記 │   ├── .. 略 13年2月9日土曜日
  • 10.
    実行準備 #1 % gem install librarian chef spiceweasel % git clone git://github.com/opscode/openstack-chef-repo.git % cd openstack-chef-repo % librarian-chef update # cookbooks 取得 % vim environments/production.rb ... 略 "osops_networks" => { "public" => "10.200.8.0/24", "management" => "10.200.8.0/24", "nova" => "10.200.8.0/24" }, ... 略 * 追記修正 13年2月9日土曜日
  • 11.
    実行準備 #2 % vim infrastructure.yml cookbooks: - keystone: #used by keystone role version: 2012.1.1 ... 略 roles: - base: - rabbitmq-server: - keystone: ... 略 environments: - production: nodes: - 10.200.8.19: run_list: role[allinone] options: -i ~/.ssh/id_rsa -x root -E production * 追記修正 13年2月9日土曜日
  • 12.
    実行 % spiceweasel infrastructure.yml # コマンドライン出力 knife cookbook upload apache2 knife cookbook upload apt ... 略 knife environment from file production.rb knife role from file base.rb knife role from file rabbitmq-server.rb ... 略 knife bootstrap 10.200.8.19 -i ~/.ssh/id_rsa -x root -E production -r 'role[allinone]' % spiceweasel -e infrastructure.yml # 実行 ... 10分程度待機 完成! :D 13年2月9日土曜日
  • 13.
    まとめ • spiceweasel がインテグレーションしてくれる • librarian で cookbooks を取得 # berkshelf に置き換えてほしい • environments にて複数環境を管理出来る (staging, testing ..) • ‘all in one’ 構成も複数台構成も可能 #複数台は未確認 • folsom ベースは直ちに開発が始まるそう, 現在は essex ベース • chef はインストールツールではなく ‘継続的にデプロイ(運用)す るためのフレームワーク’ である 13年2月9日土曜日