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