OSDN Git Service

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