OSDN Git Service

refactor node_commons role.
authorwhitestar <whitestar@gaea.test>
Sun, 30 Jun 2013 02:41:21 +0000 (11:41 +0900)
committerwhitestar <whitestar@gaea.test>
Sun, 30 Jun 2013 02:41:21 +0000 (11:41 +0900)
35 files changed:
cookbooks/ganglia/metadata.rb
cookbooks/hbase/recipes/default.rb
cookbooks/node_commons/metadata.rb
cookbooks/node_commons/recipes/apt.rb [moved from cookbooks/server_commons/recipes/default.rb with 78% similarity]
cookbooks/node_commons/recipes/default.rb
cookbooks/node_commons/recipes/yum-epel.rb [moved from cookbooks/yum_epel/recipes/default.rb with 92% similarity]
cookbooks/pig/recipes/default.rb
cookbooks/server_commons/CHANGELOG.md [deleted file]
cookbooks/server_commons/README.md [deleted file]
cookbooks/server_commons/metadata.rb [deleted file]
cookbooks/yum_epel/CHANGELOG.md [deleted file]
cookbooks/yum_epel/README.md [deleted file]
cookbooks/yum_epel/metadata.rb [deleted file]
cookbooks/zookeeper/recipes/default.rb
roles/apt.rb [new file with mode: 0644]
roles/ganglia-gmetad.rb
roles/ganglia-gmond.rb
roles/ganglia-web.rb
roles/grid-adm.rb
roles/grid-gm.rb
roles/grid-gpm.rb
roles/grid-ns.rb
roles/grid-zk-colo00.rb
roles/node_commons.rb [new file with mode: 0644]
roles/pleiades-dn.rb
roles/pleiades-gm.rb
roles/pleiades-gw.rb
roles/pleiades-hm.rb
roles/pleiades-jt.rb
roles/pleiades-nm.rb
roles/pleiades-nn.rb
roles/pleiades-pxy.rb
roles/pleiades-wf.rb
roles/test-on-localhost.rb
roles/yum-epel.rb [moved from roles/yum_epel.rb with 89% similarity]

index f2f8918..6a6023d 100644 (file)
@@ -10,4 +10,4 @@ version          '0.1.0'
   supports os
 end
 
-depends          'yum_epel'
+depends          'node_commons'
index 7297425..854a84f 100644 (file)
@@ -168,7 +168,8 @@ if ! FileTest.directory? install_root then
     action :create
   end
 
-  package 'tar' do
+  pkg = 'tar'
+  resources(:package => pkg) rescue package pkg do
     action :install
   end
 
index d619ad8..ec8580f 100644 (file)
@@ -5,3 +5,11 @@ license          'Apache 2.0'
 description      'Installs/Configures node_commons'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
 version          '0.1.0'
+
+%w{ debian ubuntu centos redhat fedora }.each do |os|
+  supports os
+end
+
+depends          'apt'
+depends          'yum'
+
similarity index 78%
rename from cookbooks/server_commons/recipes/default.rb
rename to cookbooks/node_commons/recipes/apt.rb
index e1c1ae5..56ac1de 100644 (file)
@@ -1,8 +1,8 @@
 #
-# Cookbook Name:: server_commons
-# Recipe:: default
+# Cookbook Name:: node_commons
+# Recipe:: apt
 #
-# Copyright 2013, YOUR_COMPANY_NAME
+# Copyright 2013, whitestar
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -16,3 +16,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
+if node[:platform_family] == 'debian' then
+  include_recipe 'apt::default'
+end
+
index 631bf5b..8d4122d 100644 (file)
 # limitations under the License.
 #
 
-package 'ntp' do
+pkg = 'ntp'
+resources(:package => pkg) rescue package pkg do
   action :install
 end
 
-case node[:platform_family]
-  when 'debian'
-    service 'ntp' do
-      action [:enable, :start]
-      supports :status => true, :restart => true, :reload => false
-    end
-  when 'rhel'
-    service 'ntpd' do
-      action [:enable, :start]
-      supports :status => true, :restart => true, :reload => false
-    end
+serv = value_for_platform_family(
+  'debian' => 'ntp',
+  'rhel'   => 'ntpd'
+)
+
+resources(:service => serv) rescue service serv do
+  action [:enable, :start]
+  supports :status => true, :restart => true, :reload => false
 end
 
similarity index 92%
rename from cookbooks/yum_epel/recipes/default.rb
rename to cookbooks/node_commons/recipes/yum-epel.rb
index 7531a3e..4337e68 100644 (file)
@@ -1,6 +1,6 @@
 #
-# Cookbook Name:: yum_epel
-# Recipe:: default
+# Cookbook Name:: node_commons
+# Recipe:: yum-epel
 #
 # Copyright 2013, whitestar
 #
index 79a1c49..b610cda 100644 (file)
@@ -102,7 +102,8 @@ if ! FileTest.directory? install_root then
     action :create
   end
 
-  package 'tar' do
+  pkg = 'tar'
+  resources(:package => pkg) rescue package pkg do
     action :install
   end
 
diff --git a/cookbooks/server_commons/CHANGELOG.md b/cookbooks/server_commons/CHANGELOG.md
deleted file mode 100644 (file)
index 4489602..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# CHANGELOG for server_commons
-
-This file is used to list changes made in each version of server_commons.
-
-## 0.1.0:
-
-* Initial release of server_commons
-
-- - -
-Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
-
-The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
diff --git a/cookbooks/server_commons/README.md b/cookbooks/server_commons/README.md
deleted file mode 100644 (file)
index 3a5e5b5..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-server_commons Cookbook
-=======================
-TODO: Enter the cookbook description here.
-
-e.g.
-This cookbook makes your favorite breakfast sandwhich.
-
-Requirements
-------------
-TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
-
-e.g.
-#### packages
-- `toaster` - server_commons needs toaster to brown your bagel.
-
-Attributes
-----------
-TODO: List you cookbook attributes here.
-
-e.g.
-#### server_commons::default
-<table>
-  <tr>
-    <th>Key</th>
-    <th>Type</th>
-    <th>Description</th>
-    <th>Default</th>
-  </tr>
-  <tr>
-    <td><tt>['server_commons']['bacon']</tt></td>
-    <td>Boolean</td>
-    <td>whether to include bacon</td>
-    <td><tt>true</tt></td>
-  </tr>
-</table>
-
-Usage
------
-#### server_commons::default
-TODO: Write usage instructions for each cookbook.
-
-e.g.
-Just include `server_commons` in your node's `run_list`:
-
-```json
-{
-  "name":"my_node",
-  "run_list": [
-    "recipe[server_commons]"
-  ]
-}
-```
-
-Contributing
-------------
-TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
-
-e.g.
-1. Fork the repository on Github
-2. Create a named feature branch (like `add_component_x`)
-3. Write you change
-4. Write tests for your change (if applicable)
-5. Run the tests, ensuring they all pass
-6. Submit a Pull Request using Github
-
-License and Authors
--------------------
-Authors: TODO: List authors
diff --git a/cookbooks/server_commons/metadata.rb b/cookbooks/server_commons/metadata.rb
deleted file mode 100644 (file)
index 528e74e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-name             'server_commons'
-maintainer       'YOUR_COMPANY_NAME'
-maintainer_email 'YOUR_EMAIL'
-license          'Apache 2.0'
-description      'Installs/Configures server_commons'
-long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.1.0'
diff --git a/cookbooks/yum_epel/CHANGELOG.md b/cookbooks/yum_epel/CHANGELOG.md
deleted file mode 100644 (file)
index 35d8122..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# CHANGELOG for yum_epel
-
-This file is used to list changes made in each version of yum_epel.
-
-## 0.1.0:
-
-* Initial release of yum_epel
-
-- - -
-Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
-
-The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
diff --git a/cookbooks/yum_epel/README.md b/cookbooks/yum_epel/README.md
deleted file mode 100644 (file)
index cb67763..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-yum_epel Cookbook
-=================
-TODO: Enter the cookbook description here.
-
-e.g.
-This cookbook makes your favorite breakfast sandwhich.
-
-Requirements
-------------
-TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
-
-e.g.
-#### packages
-- `toaster` - yum_epel needs toaster to brown your bagel.
-
-Attributes
-----------
-TODO: List you cookbook attributes here.
-
-e.g.
-#### yum_epel::default
-<table>
-  <tr>
-    <th>Key</th>
-    <th>Type</th>
-    <th>Description</th>
-    <th>Default</th>
-  </tr>
-  <tr>
-    <td><tt>['yum_epel']['bacon']</tt></td>
-    <td>Boolean</td>
-    <td>whether to include bacon</td>
-    <td><tt>true</tt></td>
-  </tr>
-</table>
-
-Usage
------
-#### yum_epel::default
-TODO: Write usage instructions for each cookbook.
-
-e.g.
-Just include `yum_epel` in your node's `run_list`:
-
-```json
-{
-  "name":"my_node",
-  "run_list": [
-    "recipe[yum_epel]"
-  ]
-}
-```
-
-Contributing
-------------
-TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
-
-e.g.
-1. Fork the repository on Github
-2. Create a named feature branch (like `add_component_x`)
-3. Write you change
-4. Write tests for your change (if applicable)
-5. Run the tests, ensuring they all pass
-6. Submit a Pull Request using Github
-
-License and Authors
--------------------
-Authors: TODO: List authors
diff --git a/cookbooks/yum_epel/metadata.rb b/cookbooks/yum_epel/metadata.rb
deleted file mode 100644 (file)
index 926e9f7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-name             'yum_epel'
-maintainer       'whitestar'
-maintainer_email ''
-license          'Apache 2.0'
-description      'Installs/Configures yum_epel'
-long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.1.0'
-
-%w{ debian ubuntu centos redhat fedora }.each do |os|
-  supports os
-end
-
-depends          'yum'
index cdeba09..6429e78 100644 (file)
@@ -151,7 +151,8 @@ if ! FileTest.directory? install_root then
     action :create
   end
 
-  package 'tar' do
+  pkg = 'tar'
+  resources(:package => pkg) rescue package pkg do
     action :install
   end
 
diff --git a/roles/apt.rb b/roles/apt.rb
new file mode 100644 (file)
index 0000000..9ea35ca
--- /dev/null
@@ -0,0 +1,11 @@
+name 'apt'
+description 'APT management tools. this role does nothing in other platforms than Debian.'
+
+run_list(
+  'recipe[node_commons::apt]'
+)
+
+#run_list "recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]"
+#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
+#default_attributes "apache2" => { "listen_ports" => [ "80", "443" ] }
+#override_attributes "apache2" => { "max_children" => "50" }
index 3d35940..2a45732 100644 (file)
@@ -2,7 +2,7 @@ name 'ganglia-gmetad'
 description 'Ganglia gmetad default'
 
 run_list(
-  'role[yum_epel]',
+  'role[yum-epel]',
   'recipe[ganglia::gmetad]'
 )
 
index 00c52ce..5a5865b 100644 (file)
@@ -2,7 +2,7 @@ name 'ganglia-gmond'
 description 'Ganglia gmond default'
 
 run_list(
-  'role[yum_epel]',
+  'role[yum-epel]',
   'recipe[ganglia::gmond]'
 )
 
index d50a769..7002d81 100644 (file)
@@ -2,7 +2,7 @@ name 'ganglia-web'
 description 'Ganglia web frontend'
 
 run_list(
-  'role[yum_epel]',
+  'role[yum-epel]',
   'recipe[ganglia::web]'
 )
 
index be94414..2ca8fbd 100644 (file)
@@ -2,6 +2,7 @@ name 'grid-adm'
 description 'Grid administrative station node'
 
 run_list(
+  'role[node_commons]',
   'role[nameservice-client-grid]',
   'role[ganglia-gmond]',
   'role[chef-workstation]',
index e19ca42..840a591 100644 (file)
@@ -5,6 +5,7 @@ name 'grid-gm'
 description 'Grid Base ganglia gmetad node'
 
 run_list(
+  'role[node_commons]',
   'role[nameservice-client-grid]',
   'role[ganglia-gmond]',
   'role[ganglia-gmetad]',
index 80fe325..592a3a5 100644 (file)
@@ -2,6 +2,7 @@ name 'grid-gpm'
 description 'Grid provisioning master node'
 
 run_list(
+  'role[node_commons]',
   'role[ganglia-gmond]',
 )
 
index 4b1a6f0..ad7a734 100644 (file)
@@ -3,6 +3,7 @@ description 'Grid nameservice node'
 
 run_list(
   # TODO:
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]'
 )
index 9a3dbc3..a374e64 100644 (file)
@@ -2,6 +2,7 @@ name 'grid-zk-colo00'
 description 'Grid ZooKeeper colo00 node'
 
 run_list(
+  'role[node_commons]',
   'role[ganglia-gmond]',
   'role[zookeeper-colo00-with-security]',
 )
diff --git a/roles/node_commons.rb b/roles/node_commons.rb
new file mode 100644 (file)
index 0000000..f684460
--- /dev/null
@@ -0,0 +1,12 @@
+name 'node_commons'
+description 'Node common role.'
+
+run_list(
+  'role[apt]',
+  'recipe[node_commons]'
+)
+
+#run_list "recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]"
+#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
+#default_attributes "apache2" => { "listen_ports" => [ "80", "443" ] }
+#override_attributes "apache2" => { "max_children" => "50" }
index aeda738..8cfa053 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-dn'
 description 'Pleiades DataNode node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]',
   'role[pleiades-node]'
index 2ccb6ba..51a24b3 100644 (file)
@@ -5,6 +5,7 @@ name 'pleiades-gm'
 description 'Pleiades ganglia gmetad node'
 
 run_list(
+  'role[node_commons]',
   'role[nameservice-client-grid]',
   'role[ganglia-gmond]',
   'role[ganglia-gmetad]',
index 4c8a777..8468708 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-gw'
 description 'Pleiades gateway node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]',
   'role[pleiades-node]',
index 84ea374..ca21acc 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-hm'
 description 'Pleiades HBase Master node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]',
   'role[pleiades-node]'
index 65e3d35..84a714d 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-jt'
 description 'Pleiades JobTracker node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]',
   'role[pleiades-node]'
index 9e39040..8f3a415 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-nm'
 description 'Pleiades nagios node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]'
 )
index 8a93b94..cdad7a5 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-nn'
 description 'Pleiades NameNode node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]',
   'role[pleiades-node]'
index d39a360..82ac446 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-pxy'
 description 'Pleiades proxy node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]'
 )
index a4ed12f..fd4354b 100644 (file)
@@ -2,6 +2,7 @@ name 'pleiades-wf'
 description 'Pleiades workflow node'
 
 run_list(
+  'role[node_commons]',
   'role[grid-realm]',
   'role[ganglia-gmond]'
 )
index fd433b9..9890dc8 100644 (file)
@@ -3,6 +3,7 @@ description 'Testing on local machine'
 
 run_list(
   'role[mocker]',
+  'role[node_commons]',
   'role[chef_utils]',
   'role[nameservice-client]',
   'role[ganglia-gmond-ucast-localhost]',
similarity index 89%
rename from roles/yum_epel.rb
rename to roles/yum-epel.rb
index b7a04d3..31b438c 100644 (file)
@@ -1,9 +1,9 @@
-name 'yum_epel'
+name 'yum-epel'
 description 'Extra Packages for Enterprise Linux. this role does nothing in other platforms than RHEL.'
 
 run_list(
   'recipe[yum]',
-  'recipe[yum_epel]'
+  'recipe[node_commons::yum-epel]'
 )
 
 #run_list "recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]"