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