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 |
|
9 |
include ssh::auth |
10 |
ssh::auth::key { $build_login: } # declare a key for build bot: RSA, 2048 bits |
11 |
ssh::auth::key { $sched_login: } # declare a key for sched bot: RSA, 2048 bits |
12 |
} |
13 |
|
14 |
class mainnode inherits base { |
15 |
include iurtuser |
16 |
|
17 |
sshuser { $sched_login: |
18 |
homedir => $sched_home_dir, |
19 |
comment => "System user used to schedule builds", |
20 |
} |
21 |
|
22 |
ssh::auth::client { $sched_login: } |
23 |
ssh::auth::server { $build_login: } |
24 |
|
25 |
$package_list = ['task-bs-cluster-main', 'iurt'] |
26 |
package { $package_list: |
27 |
ensure => "installed" |
28 |
} |
29 |
|
30 |
apache::vhost_other_app { "repository.$domain": |
31 |
vhost_file => "buildsystem/vhost_repository.conf", |
32 |
} |
33 |
|
34 |
include scheduler |
35 |
include gatherer |
36 |
} |
37 |
|
38 |
class buildnode inherits base { |
39 |
include iurt |
40 |
} |
41 |
|
42 |
class scheduler { |
43 |
# ulri |
44 |
include iurtupload |
45 |
} |
46 |
|
47 |
class gatherer { |
48 |
# emi |
49 |
include iurtupload |
50 |
} |
51 |
|
52 |
class iurtupload { |
53 |
file { "/etc/iurt/update.conf": |
54 |
ensure => present, |
55 |
owner => $build_login, |
56 |
group => $build_login, |
57 |
mode => 644, |
58 |
require => File["/etc/iurt"], |
59 |
content => template("buildsystem/upload.conf") |
60 |
} |
61 |
} |
62 |
|
63 |
class repsys { |
64 |
package { 'repsys': |
65 |
|
66 |
} |
67 |
|
68 |
|
69 |
} |
70 |
|
71 |
define sshuser($homedir, $comment) { |
72 |
group {"$title": |
73 |
ensure => present, |
74 |
} |
75 |
|
76 |
user {"$title": |
77 |
ensure => present, |
78 |
comment => $comment, |
79 |
managehome => true, |
80 |
gid => $title, |
81 |
shell => "/bin/bash", |
82 |
notify => Exec["unlock$title"], |
83 |
require => Group[$title], |
84 |
} |
85 |
|
86 |
# set password to * to unlock the account but forbid login through login |
87 |
exec { "unlock$title": |
88 |
command => "usermod -p '*' $title", |
89 |
refreshonly => true, |
90 |
} |
91 |
|
92 |
file { $homedir: |
93 |
ensure => "directory", |
94 |
require => User[$title], |
95 |
} |
96 |
|
97 |
file { "$homedir/.ssh": |
98 |
ensure => "directory", |
99 |
mode => 600, |
100 |
owner => $title, |
101 |
group => $title, |
102 |
require => File[$homedir], |
103 |
} |
104 |
} |
105 |
|
106 |
class iurtuser { |
107 |
sshuser { $build_login: |
108 |
homedir => $build_home_dir, |
109 |
comment => "System user used to run build bots", |
110 |
} |
111 |
|
112 |
file { "/etc/iurt": |
113 |
ensure => "directory", |
114 |
} |
115 |
} |
116 |
|
117 |
class iurt { |
118 |
include sudo |
119 |
include iurtuser |
120 |
ssh::auth::client { $build_login: } |
121 |
ssh::auth::server { $sched_login: user => $build_login } |
122 |
|
123 |
# build node common settings |
124 |
# we could have the following skip list to use less space: |
125 |
# '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/' |
126 |
$package_list = ['task-bs-cluster-chroot', 'iurt'] |
127 |
package { $package_list: |
128 |
ensure => installed; |
129 |
} |
130 |
|
131 |
file { "/etc/iurt/build": |
132 |
ensure => "directory", |
133 |
require => File["/etc/iurt"], |
134 |
} |
135 |
|
136 |
file { "/etc/iurt/build/cauldron.conf": |
137 |
ensure => present, |
138 |
owner => $build_login, |
139 |
group => $build_login, |
140 |
mode => 644, |
141 |
require => File["/etc/iurt/build"], |
142 |
content => template("buildsystem/iurt.cauldron.conf") |
143 |
} |
144 |
|
145 |
file { "/etc/sudoers.d/iurt": |
146 |
ensure => present, |
147 |
owner => root, |
148 |
group => root, |
149 |
mode => 440, |
150 |
content => template("buildsystem/sudoers.iurt") |
151 |
} |
152 |
} |
153 |
} |