OSDN Git Service

improve the backup and restore scripts.
[metasearch/grid-chef-repo.git] / roles / grid-gpm.rb
1 #
2 # Copyright 2013-2014, whitestar
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 $LOAD_PATH.push("#{File.dirname(__FILE__)}/_lib")
18 #${chef-repo}/roles/_lib/grid.rb
19 require 'grid'
20
21 name 'grid-gpm'
22 description 'Grid provisioning master node'
23
24 run_list(
25   'role[node_commons]',
26   'role[ganglia-gmond]',
27   'role[berkshelf-api-server]',
28 )
29
30 #env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
31
32 this_subcluster = Grid::CLUSTERS[:base][:provisioningmasters]
33 mcast_addr = this_subcluster[:mcast_addr]
34 port = '8649'
35 =begin
36 # uni-cast
37 udp_send_channels4ucast = []
38 this_subcluster[:nodes].first(2).each {|host|
39   udp_send_channels4ucast.push(
40     {
41       'mcast_join' => '',
42       'host' => "#{host}.#{Grid::DOMAIN}",
43       'port' => port,
44       'ttl' => ''
45     }
46   )
47 }
48 =end
49
50 default_attributes(
51 )
52
53 override_attributes(
54   'berkshelf_api' => {
55     'host' => "gpm00.#{Grid::DOMAIN}",
56     'proxy_port' => 6280,
57     'app_host' => '127.0.0.1',
58     'port' => 26200,
59     'proxy' => {
60       'ssl' => true,
61       'ssl_certificate'     => '/etc/pki/tls/certs/01gpm00_server.crt',
62       'ssl_certificate_key' => '/etc/pki/tls/private/01gpm00_server.key',
63     }, 
64     'config' => {
65       'build_interval' => 180.0,
66       'endpoints' => [
67         {
68           'type' => 'chef_server',
69           'options' => {
70             'url' => 'https://api.opscode.com/organizations/gridverse',  # hosted chef
71             'client_key' => '/etc/berkshelf/api-server/gridverse-berkshelf.pem',
72             'client_name' => 'berkshelf',
73             'ssl_verify' => true
74           }
75         },
76         {
77           'type' => 'chef_server',
78           'options' => {
79             #'url' => 'https://gpm00.grid.example.com/organizations/grid',  # chef12
80             'url' => 'https://gpm00.grid.example.com',  # chef11
81             'client_key' => '/etc/berkshelf/api-server/grid-berkshelf.pem',
82             'client_name' => 'berkshelf',
83             'ssl_verify' => false
84           }
85         },
86       ],
87     },
88   },
89   'ganglia' => {
90     # gmond
91     'cluster' => {
92       'name' => this_subcluster[:alias],
93       'owner' => Grid::DOMAIN
94     },
95     # static multi-cast
96     'static' => {
97       'udp_send_channels' => [
98         {
99           'mcast_join' => mcast_addr,
100           'host' => '',
101           'port' => port,
102           'ttl' => '1'
103         }
104       ],
105       'udp_recv_channels' => [
106         {
107           'mcast_join' => mcast_addr,
108           'port' => port,
109           'bind' => mcast_addr
110         }
111       ]
112 =begin
113       ## static uni-cast
114       'udp_send_channels' => udp_send_channels4ucast,
115       'udp_recv_channels' => [
116         {
117           'mcast_join' => '',
118           'port' => port,
119           'bind' => ''
120         }
121       ]
122 =end
123     }
124   }
125 )