Grid環境構築用のChefリポジトリです。
Revision | 5ad4bd279420debf8d732409388e8acd0b355e9f (tree) |
---|---|
Time | 2015-11-05 19:26:04 |
Author | whitestar <whitestar@gaea...> |
Commiter | whitestar |
add crond and httpd recipes to the commons cookbook.
@@ -6,7 +6,7 @@ This cookbook contains common utility libraries. | ||
6 | 6 | Requirements |
7 | 7 | ------------ |
8 | 8 | |
9 | -Nothing. | |
9 | +- OS: Debian family or Red Hat Enterprise Linux family. | |
10 | 10 | |
11 | 11 | Attributes |
12 | 12 | ---------- |
@@ -17,10 +17,16 @@ Usage | ||
17 | 17 | ----- |
18 | 18 | #### libraries |
19 | 19 | - `Commons::PackageUtils::get_cron_pkg_name` |
20 | +- `Commons::PackageUtils::get_cron_serv_name` | |
20 | 21 | - `Commons::PackageUtils::get_httpd_pkg_name` |
22 | +- `Commons::PackageUtils::get_httpd_serv_name` | |
21 | 23 | - `Commons::PackageUtils::get_jsvc_pkg_name` |
22 | 24 | - `Commons::PackageUtils::get_libbz2_pkg_name` |
23 | 25 | |
26 | +#### recipes | |
27 | +- `commons::crond` - installs cron package and enables & starts the service. | |
28 | +- `commons::httpd` - installs httpd package and enables & starts the service. | |
29 | + | |
24 | 30 | License and Authors |
25 | 31 | ------------------- |
26 | 32 | - Author:: whitestar at osdn.jp |
@@ -27,6 +27,14 @@ module Commons | ||
27 | 27 | end |
28 | 28 | |
29 | 29 | |
30 | + def get_cron_serv_name | |
31 | + case node[:platform_family] | |
32 | + when 'debian'then return 'cron' | |
33 | + when 'rhel' then return 'crond' | |
34 | + end | |
35 | + end | |
36 | + | |
37 | + | |
30 | 38 | def get_httpd_pkg_name |
31 | 39 | case node[:platform_family] |
32 | 40 | when 'debian'then return 'apache2' |
@@ -35,6 +43,14 @@ module Commons | ||
35 | 43 | end |
36 | 44 | |
37 | 45 | |
46 | + def get_httpd_serv_name | |
47 | + case node[:platform_family] | |
48 | + when 'debian'then return 'apache2' | |
49 | + when 'rhel' then return 'httpd' | |
50 | + end | |
51 | + end | |
52 | + | |
53 | + | |
38 | 54 | def get_jsvc_pkg_name |
39 | 55 | case node[:platform_family] |
40 | 56 | when 'debian' then return 'jsvc' |
@@ -4,4 +4,4 @@ maintainer_email '' | ||
4 | 4 | license 'Apache 2.0' |
5 | 5 | description 'Installs/Configures commons' |
6 | 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
7 | -version '0.1.0' | |
7 | +version '0.2.0' |
@@ -0,0 +1,32 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: commons | |
3 | +# Recipe:: crond | |
4 | +# | |
5 | +# Copyright 2015, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +::Chef::Recipe.send(:include, Commons::PackageUtils) | |
21 | + | |
22 | +pkg = get_cron_pkg_name | |
23 | +resources(:package => pkg) rescue package pkg do | |
24 | + action :install | |
25 | +end | |
26 | + | |
27 | +serv = get_cron_serv_name | |
28 | +resources(:service => serv) rescue service serv do | |
29 | + action [:enable, :start] | |
30 | + supports :status => true, :restart => true, :reload => false | |
31 | +end | |
32 | + |
@@ -0,0 +1,32 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: commons | |
3 | +# Recipe:: httpd | |
4 | +# | |
5 | +# Copyright 2015, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +::Chef::Recipe.send(:include, Commons::PackageUtils) | |
21 | + | |
22 | +pkg = get_httpd_pkg_name | |
23 | +resources(:package => pkg) rescue package pkg do | |
24 | + action :install | |
25 | +end | |
26 | + | |
27 | +serv = get_httpd_serv_name | |
28 | +resources(:service => serv) rescue service serv do | |
29 | + action [:enable, :start] | |
30 | + supports :status => true, :restart => true, :reload => false | |
31 | +end | |
32 | + |
@@ -18,7 +18,8 @@ name 'chef-client' | ||
18 | 18 | description 'Chef Client' |
19 | 19 | |
20 | 20 | run_list( |
21 | - 'recipe[chef-client::cron]' | |
21 | + 'recipe[commons::crond]', | |
22 | + 'recipe[chef-client::cron]', | |
22 | 23 | ) |
23 | 24 | |
24 | 25 | #env_run_lists() |