OSDN Git Service

fix service control.
[metasearch/grid-chef-repo.git] / roles / grid-ftp.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-ftp'
22 description 'Grid distribution node'
23
24 run_list(
25   'role[node_commons]',
26   'role[apt-mirror]',
27   'role[apt-cacher-ng]',
28   'role[apt-source]',
29   'role[yum-mirror]',
30   #'role[yum-repos]',
31   'role[yum-cdh]',
32   'role[cdh-mirror]',
33   'role[yum-hdp]',
34   'role[hdp-mirror]',
35   'role[apache-mirror]',
36   #'role[ganglia-gmond]',
37 )
38
39 #env_run_lists()
40
41 this_subcluster = Grid::CLUSTERS[:base][:admins]
42 mcast_addr = this_subcluster[:mcast_addr]
43 port = '8649'
44 =begin
45 # uni-cast
46 udp_send_channels4ucast = []
47 this_subcluster[:nodes].first(2).each {|host|
48   udp_send_channels4ucast.push(
49     {
50       'mcast_join' => '',
51       'host' => "#{host}.#{Grid::DOMAIN}",
52       'port' => port,
53       'ttl' => ''
54     }
55   )
56 }
57 =end
58
59 default_attributes(
60 )
61
62 override_attributes(
63   'apache_utils' => {
64     'mirror' => {
65       'cron_period' => '5 23   * * *'
66     }
67   },
68   'apt_utils' => {
69     'source' => {
70       'apt_lines' => [
71         '#deb http://cdn.debian.net/debian wheezy main contrib non-free',
72         '#deb http://cdn.debian.net/debian wheezy-updates main contrib',
73         '#deb http://cdn.debian.net/debian wheezy-backports main contrib non-free',
74         '#deb http://security.debian.org/ wheezy/updates main contrib non-free',
75         # self test
76         'deb http://ftp.grid.example.com/debian wheezy main contrib non-free',
77         'deb http://ftp.grid.example.com/debian wheezy-updates main contrib',
78         'deb http://ftp.grid.example.com/debian wheezy-backports main contrib non-free',
79         'deb http://ftp.grid.example.com:3142/security.debian.org/ wheezy/updates main contrib non-free'
80       ]
81     },
82     'mirror' => {
83       'cron_period' => '5 22   * * *',
84       'country' => 'jp',
85       'distributions' => {
86         'debian' => {
87           'code_names' => [
88             'wheezy',
89             'wheezy-updates',
90             'wheezy-backports',
91             'squeeze',
92             'squeeze-updates',
93             'squeeze-backports',
94           ],
95           'architectures' => [
96             'amd64',
97             'i386'
98             #'src',
99           ],
100           'components' => [
101             'main',
102             'contrib',
103             'non-free'
104           ]
105         }
106       }
107     }
108   },
109   'cdh' => {
110     'version' => '4.4.0',
111     'yum_repo' => {
112       'with_gplextras' => true,
113       'update' => true,
114       'only_for_mirroring' => true,
115       'mirroring' => {
116         'platform' => 'centos',
117         'platform_version' => '6',
118         'arch' => 'x86_64'
119       }
120     },
121     'yum_mirror' => {
122       'cron_period' => '5 20   * * *',
123       'repo_ids' => [
124         'cloudera-cdh4',
125         'cloudera-gplextras4',
126       ],
127       'arch' => 'x86_64',
128       'url_alias_with_authority_part' => true
129     }
130   },
131   'hdp' => {
132     'version' => '1.3.2',
133     #'version' => '1.2.3.1',
134     'yum_repo' => {
135       'update' => true,
136       'only_for_mirroring' => true,
137       'mirroring' => {
138         'platform' => 'centos',
139         'platform_version' => '6'
140       }
141     },
142     'yum_mirror' => {
143       'cron_period' => '35 20   * * *',
144       'repo_ids' => [
145         'HDP-1.x',
146         'Updates-HDP-1.x',
147         'HDP-UTILS-1.1.0.16',
148         'ambari-1.x',
149         'Updates-ambari-1.2.5.17'
150       ],
151       'url_alias_with_authority_part' => true
152     }
153   },
154   'yum_utils' => {
155     'repos' => {
156       'CentOS-Base' => {
157         'mirrorlist_ctx' => '', # default: inactive
158         #'mirrorlist_ctx' => 'http://mirrorlist.centos.org',
159         'baseurl_ctx' => '',  # default: inactive
160         #'baseurl_ctx' => 'http://mirror.centos.org/centos',
161         #'baseurl_ctx' => 'http://ftp.grid.example.com/centos',
162         'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6'
163       },   
164       'epel' => {
165         'mirrorlist_ctx' => '', # default: inactive
166         #'mirrorlist_ctx' => 'http://mirrors.fedoraproject.org',
167         'baseurl_ctx' => '',  # default: inactive
168         #'baseurl_ctx' => 'http://ftp.grid.example.com/fedora/epel',
169         'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6'
170       }
171     },
172     'mirror' => {
173       'cron_period' => '5 21   * * *',
174       'rsync_sources' => [
175         {
176           # CentOS
177           'url' => 'rsync://ftp.riken.jp/centos/',
178           # 5.9 or later
179           'rsync_opts' => '-avSH --stats --partial --delete --safe-links --exclude /[1-4]*/ --exclude /5.[0-8]/ --exclude /6.[0-3]/ --exclude local* --exclude isos --exclude ppc*',
180           # 6.4 or later
181           #'rsync_opts' => '-avSH --stats --partial --delete --safe-links --exclude /[1-5]*/ --exclude /6.[0-3]/ --exclude local* --exclude isos --exclude ppc*',
182           'http_alias' => '/centos'
183         },
184         {
185           # EPEL
186           'url' => 'rsync://ftp.riken.jp/fedora/epel/',
187           # 5 or later
188           'rsync_opts' => '-avSH --stats --partial --delete --safe-links --exclude /[1-4]*/ --exclude local* --exclude isos --exclude ppc*',
189           # 6 or later
190           #'rsync_opts' => '-avSH --stats --partial --delete --safe-links --exclude /[1-5]*/ --exclude local* --exclude isos --exclude ppc*',
191           'http_alias' => '/fedora/epel'
192         }
193       ]
194     }
195   },
196   'ganglia' => {
197     # gmond
198     'cluster' => {
199       'name' => this_subcluster[:alias],
200       'owner' => Grid::DOMAIN
201     },
202     ## static multi-cast
203     'static' => {
204       'udp_send_channels' => [
205         {
206           'mcast_join' => mcast_addr,
207           'host' => '',
208           'port' => port,
209           'ttl' => '1'
210         }
211       ],
212       'udp_recv_channels' => [
213         {
214           'mcast_join' => mcast_addr,
215           'port' => port,
216           'bind' => mcast_addr
217         }
218       ]
219 =begin
220       ## static uni-cast
221       'udp_send_channels' => udp_send_channels4ucast,
222       'udp_recv_channels' => [
223         {
224           'mcast_join' => '',
225           'port' => port,
226           'bind' => ''
227         }
228       ]
229 =end
230     }
231   }
232 )