1 |
class buildsystem { |
2 |
|
3 |
class base { |
4 |
$build_login = "iurt" |
5 |
$build_home_dir = "/home/$build_login" |
6 |
$sched_login = "schedbot" |
7 |
$sched_home_dir = "/home/$sched_login" |
8 |
$repository_root = "/distrib/bootstrap" |
9 |
$packagers_group = 'mga-packagers' |
10 |
$createsrpm_path = '/usr/share/repsys/create-srpm' |
11 |
|
12 |
include ssh::auth |
13 |
ssh::auth::key { $build_login: } # declare a key for build bot: RSA, 2048 bits |
14 |
ssh::auth::key { $sched_login: } # declare a key for sched bot: RSA, 2048 bits |
15 |
} |
16 |
|
17 |
class mainnode inherits base { |
18 |
include iurtuser |
19 |
|
20 |
sshuser { $sched_login: |
21 |
homedir => $sched_home_dir, |
22 |
comment => "System user used to schedule builds", |
23 |
} |
24 |
|
25 |
ssh::auth::client { $sched_login: } |
26 |
ssh::auth::server { $sched_login: } |
27 |
ssh::auth::server { $build_login: } |
28 |
|
29 |
# FIXME Add again task-bs-cluster-main when it will require mgarepo instead of repsys |
30 |
$package_list = ['iurt'] |
31 |
package { $package_list: |
32 |
ensure => "installed" |
33 |
} |
34 |
|
35 |
apache::vhost_other_app { "repository.$domain": |
36 |
vhost_file => "buildsystem/vhost_repository.conf", |
37 |
} |
38 |
|
39 |
apache::vhost_other_app { "pkgsubmit.$domain": |
40 |
vhost_file => "buildsystem/vhost_pkgsubmit.conf", |
41 |
} |
42 |
|
43 |
include scheduler |
44 |
include gatherer |
45 |
include mgarepo |
46 |
include youri_submit |
47 |
include check_missing_deps |
48 |
} |
49 |
|
50 |
class buildnode inherits base { |
51 |
include iurt |
52 |
} |
53 |
|
54 |
class scheduler { |
55 |
# ulri |
56 |
include iurtupload |
57 |
} |
58 |
|
59 |
class gatherer { |
60 |
# emi |
61 |
include iurtupload |
62 |
} |
63 |
|
64 |
class iurtupload { |
65 |
file { "/etc/iurt/upload.conf": |
66 |
ensure => present, |
67 |
owner => $build_login, |
68 |
group => $build_login, |
69 |
mode => 644, |
70 |
require => File["/etc/iurt"], |
71 |
content => template("buildsystem/upload.conf") |
72 |
} |
73 |
} |
74 |
|
75 |
class mgarepo { |
76 |
package { 'mgarepo': |
77 |
|
78 |
} |
79 |
|
80 |
package { 'rpm-build': |
81 |
} |
82 |
|
83 |
file { "repsys.conf": |
84 |
path => "/etc/repsys.conf", |
85 |
owner => root, |
86 |
group => root, |
87 |
mode => 644, |
88 |
content => template("buildsystem/repsys.conf") |
89 |
} |
90 |
|
91 |
file { "$sched_home_dir/repsys": |
92 |
ensure => "directory", |
93 |
owner => $sched_login, |
94 |
require => File[$sched_home_dir], |
95 |
} |
96 |
|
97 |
file { "$sched_home_dir/repsys/tmp": |
98 |
ensure => "directory", |
99 |
owner => $sched_login, |
100 |
group => "mga-packagers", |
101 |
mode => 1775, |
102 |
require => File["$sched_home_dir/repsys"], |
103 |
} |
104 |
|
105 |
file { "$sched_home_dir/repsys/srpms": |
106 |
ensure => "directory", |
107 |
owner => $sched_login, |
108 |
group => "mga-packagers", |
109 |
mode => 1775, |
110 |
require => File["$sched_home_dir/repsys"], |
111 |
} |
112 |
} |
113 |
|
114 |
class youri_submit { |
115 |
include sudo |
116 |
|
117 |
file { "/usr/local/bin/mdv-youri-submit": |
118 |
owner => root, |
119 |
group => root, |
120 |
mode => 755, |
121 |
content => template("buildsystem/mdv-youri-submit") |
122 |
} |
123 |
|
124 |
file { "/usr/local/bin/mdv-youri-submit.wrapper": |
125 |
owner => root, |
126 |
group => root, |
127 |
mode => 755, |
128 |
content => template("buildsystem/mdv-youri-submit.wrapper") |
129 |
} |
130 |
|
131 |
sudo::sudoers_config { "mdv-youri-submit": |
132 |
content => template("buildsystem/sudoers.youri") |
133 |
} |
134 |
|
135 |
file { "/etc/youri": |
136 |
ensure => "directory", |
137 |
} |
138 |
|
139 |
file { "/etc/youri/submit-todo.conf": |
140 |
ensure => present, |
141 |
mode => 644, |
142 |
require => File["/etc/youri"], |
143 |
content => template("buildsystem/submit-todo.conf") |
144 |
} |
145 |
|
146 |
file { "/etc/youri/submit-upload.conf": |
147 |
ensure => present, |
148 |
mode => 644, |
149 |
require => File["/etc/youri"], |
150 |
content => template("buildsystem/submit-upload.conf") |
151 |
} |
152 |
|
153 |
file { "/etc/youri/acl.conf": |
154 |
ensure => present, |
155 |
mode => 644, |
156 |
require => File["/etc/youri"], |
157 |
content => template("buildsystem/youri_acl.conf") |
158 |
} |
159 |
|
160 |
file { '/usr/local/bin/submit_package': |
161 |
ensure => present, |
162 |
mode => 755, |
163 |
content => template('buildsystem/submit_package') |
164 |
} |
165 |
} |
166 |
|
167 |
define sshuser($homedir, $comment) { |
168 |
group {"$title": |
169 |
ensure => present, |
170 |
} |
171 |
|
172 |
user {"$title": |
173 |
ensure => present, |
174 |
comment => $comment, |
175 |
managehome => true, |
176 |
gid => $title, |
177 |
shell => "/bin/bash", |
178 |
notify => Exec["unlock$title"], |
179 |
require => Group[$title], |
180 |
} |
181 |
|
182 |
# set password to * to unlock the account but forbid login through login |
183 |
exec { "unlock$title": |
184 |
command => "usermod -p '*' $title", |
185 |
refreshonly => true, |
186 |
} |
187 |
|
188 |
file { $homedir: |
189 |
ensure => "directory", |
190 |
require => User[$title], |
191 |
} |
192 |
|
193 |
file { "$homedir/.ssh": |
194 |
ensure => "directory", |
195 |
mode => 600, |
196 |
owner => $title, |
197 |
group => $title, |
198 |
require => File[$homedir], |
199 |
} |
200 |
} |
201 |
|
202 |
class iurtuser { |
203 |
sshuser { $build_login: |
204 |
homedir => $build_home_dir, |
205 |
comment => "System user used to run build bots", |
206 |
} |
207 |
|
208 |
file { "/etc/iurt": |
209 |
ensure => "directory", |
210 |
} |
211 |
} |
212 |
|
213 |
class iurt { |
214 |
include sudo |
215 |
include iurtuser |
216 |
ssh::auth::client { $build_login: } |
217 |
ssh::auth::server { $sched_login: user => $build_login } |
218 |
|
219 |
# build node common settings |
220 |
# we could have the following skip list to use less space: |
221 |
# '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/' |
222 |
$package_list = ['task-bs-cluster-chroot', 'iurt'] |
223 |
package { $package_list: |
224 |
ensure => installed; |
225 |
} |
226 |
|
227 |
file { "/etc/iurt/build": |
228 |
ensure => "directory", |
229 |
require => File["/etc/iurt"], |
230 |
} |
231 |
|
232 |
file { "/etc/iurt/build/cauldron.conf": |
233 |
ensure => present, |
234 |
owner => $build_login, |
235 |
group => $build_login, |
236 |
mode => 644, |
237 |
require => File["/etc/iurt/build"], |
238 |
content => template("buildsystem/iurt.cauldron.conf") |
239 |
} |
240 |
|
241 |
file { "/etc/iurt/build/mandriva2010.1.conf": |
242 |
ensure => present, |
243 |
owner => $build_login, |
244 |
group => $build_login, |
245 |
mode => 644, |
246 |
require => File["/etc/iurt/build"], |
247 |
content => template("buildsystem/iurt.mandriva2010.1.conf") |
248 |
} |
249 |
|
250 |
sudo::sudoers_config { "iurt": |
251 |
content => template("buildsystem/sudoers.iurt") |
252 |
} |
253 |
} |
254 |
|
255 |
# temporary script to create home dir with ssh key |
256 |
# taking login and url as arguments |
257 |
class mgacreatehome { |
258 |
file { "/usr/local/sbin/mgacreatehome": |
259 |
ensure => present, |
260 |
owner => root, |
261 |
group => root, |
262 |
mode => 700, |
263 |
content => template("buildsystem/mgacreatehome") |
264 |
} |
265 |
} |
266 |
|
267 |
class check_missing_deps { |
268 |
file { "/usr/local/bin/missing-deps.sh": |
269 |
ensure => present, |
270 |
owner => root, |
271 |
group => root, |
272 |
mode => 700, |
273 |
content => "puppet:///modules/buildsystem/missing-deps.sh", |
274 |
} |
275 |
|
276 |
# FIXME hardcoded path |
277 |
cron { "check missing deps": |
278 |
command => "cd /var/www/bs/data && /usr/local/bin/missing-deps.sh", |
279 |
minute => "*/15", |
280 |
} |
281 |
} |
282 |
} |