| Index: modules/buildbot/manifests/master.pp |
| diff --git a/modules/buildbot/manifests/master.pp b/modules/buildbot/manifests/master.pp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d238c68e3cfeeec1b20be1cd939332a94e209e55 |
| --- /dev/null |
| +++ b/modules/buildbot/manifests/master.pp |
| @@ -0,0 +1,144 @@ |
| +# == Type: buildbot::master |
| +# |
| +# Manage Buildbot (http://buildbot.net/) master instances. |
| +# |
| +# Note that each instance implies the creation of a virtual Concat and |
| +# a virtual Concat::Fragment resource for setting up the master.cfg file. |
| +# One may either realize these resources (as done so by master::fragment |
| +# implicitly, for example) or use a custom aproach for setting up the |
|
Felix Dahlke
2015/10/02 12:39:42
Typo.
mathias
2015/10/02 13:47:41
Acknowledged.
|
| +# configuration. |
| +# |
| +# === Parameters: |
| +# |
| +# [*basedir*] |
| +# The base directory of the master, which can be configured elsewhere or, |
| +# if it's anchestors are present, relied upon the builtin defaults. |
|
Felix Dahlke
2015/10/02 12:39:43
Typo.
mathias
2015/10/02 13:47:40
Acknowledged.
|
| +# |
| +# [*database*] |
| +# Translates directly into the BuildmasterConfig['db_url'] configuration |
| +# option within the master.cfg file. |
| +# |
| +# [*ensure*] |
| +# Whether to setup the master (anything but 'absent' or 'purged') or |
| +# remove the associated resources. Note that only 'purged' implies the |
| +# removal of $basedir. |
| +# |
| +# [*http_port*] |
|
Felix Dahlke
2015/10/02 12:39:42
Nit: Maybe call this one "web_port" or something,
mathias
2015/10/02 13:47:40
Frankly I believe the http_* prefix to be better.
Felix Dahlke
2015/10/02 15:44:27
The problem with "http" is that it is a protocol -
mathias
2015/10/02 16:25:53
Acknowledged.
|
| +# Translates directly into the port portion of the BuildmasterConfig's |
| +# 'buildbotURL', but may be used in other places as well. |
| +# |
| +# [*port*] |
|
Felix Dahlke
2015/10/02 12:39:43
Maybe we should call this "slave_port" or somethin
mathias
2015/10/02 13:47:40
Acknowledged.
|
| +# Translates directly into the BuildmasterConfig['slavePortnum'] option |
| +# within the master.cfg file. |
| +# |
| +# [*project*] |
| +# A hash to optionally contain a 'title' (which translats into the config |
| +# 'title' option) and an 'url' (translates into the 'titleURL'). |
| +# |
| +# [*slaves*] |
| +# Local buildbot::slave records to setup with the master. |
| +# |
| +# [*slots*] |
|
Felix Dahlke
2015/10/02 12:39:42
Frankly, I didn't understand what this is for, wit
mathias
2015/10/02 13:47:40
Acknowledged.
|
| +# Name => password pairs of e.g. remote build slaves. |
| +# |
| +# [*system*] |
| +# Any value beside 'false' will cause the master operations to also |
| +# affect the buildbot::buildmaster service. Use this option to include |
| +# the master instance with the system daemon. |
| +# |
| +# [*user*] |
| +# The user to whom the master instance belongs to. Note that the user |
| +# is not created implicitly by this setup, except if the creation is |
| +# implied with any of the $buildbot::master_packages. |
| +# |
| +# === Examples: |
| +# |
| +# buildbot::master {'primary': |
| +# basedir => '/var/primary-buildmaster', |
| +# project => {'title' => 'Awesomeness'}, |
| +# } |
| +# |
| +# buildbot::master {'secondary': |
| +# basedir => '/var/secondary-buildmaster', |
| +# ensure => absent, |
| +# } |
| +# |
| +define buildbot::master ( |
| + $basedir = "$::buildbot::master_directory/$name", |
| + $database = "sqlite:///state.sqlite", |
| + $ensure = 'present', |
| + $http_port = 8010, |
| + $port = 9989, |
| + $project = {}, |
| + $slaves = {}, |
| + $slots = {}, |
| + $system = false, |
| + $user = $::buildbot::master_user, |
| +) { |
| + |
| + if $ensure !~ /^(absent|purged)$/ { |
| + ensure_packages($::buildbot::master_packages) |
| + realize(File[$::buildbot::master_directory]) |
| + |
| + exec {"buildmaster#$title": |
| + command => shellquote([ |
| + $::buildbot::master_runner, |
| + 'create-master', |
| + $basedir, |
| + ]), |
| + creates => "$basedir/buildbot.tac", |
| + require => [ |
| + File[$::buildbot::master_directory], |
| + Package[$::buildbot::master_packages], |
| + ], |
| + user => $user, |
| + } |
| + |
| + Exec["buildmaster#$title"] <- Exec <|creates == $basedir|> |
| + Exec["buildmaster#$title"] <- File <|path == $basedir|> |
| + |
| + $config = "$basedir/master.cfg" |
| + |
| + @concat {$config: |
| + owner => $user, |
| + require => Exec["buildmaster#$title"], |
| + } |
| + |
| + @concat::fragment {$config: |
| + content => template('buildbot/master.cfg.erb'), |
| + target => $config, |
| + } |
| + |
| + if !empty($slaves) { |
| + create_resources('buildbot::slave', $slaves) |
| + realize(Concat[$config]) |
| + realize(Concat::Fragment[$config]) |
| + } |
| + } |
| + |
| + if $system != false { |
| + ensure_packages($::buildbot::master_packages) |
| + realize(Concat['buildmaster']) |
| + realize(Concat::Fragment['buildmaster']) |
| + realize(Service['buildmaster']) |
| + |
| + concat::fragment {"buildmaster#$title": |
| + content => template('buildbot/buildmaster_fragment.erb'), |
| + ensure => $ensure ? {'present' => $ensure, default => 'absent'}, |
| + notify => Service['buildmaster'], |
| + order => 1, |
| + target => 'buildmaster', |
| + } |
| + |
| + Service['buildmaster'] <~ Exec <|creates == "$basedir"|> |
| + Service['buildmaster'] <~ Exec <|creates == "$basedir/buildbot.tac"|> |
| + Service['buildmaster'] <~ Exec <|creates == "$basedir/master.cfg"|> |
| + |
| + Service['buildmaster'] <~ File <|path == "$basedir"|> |
| + Service['buildmaster'] <~ File <|path == "$basedir/master.cfg"|> |
| + } |
| + |
| + if $ensure == 'purged' { |
| + file {$basedir: ensure => 'absent'} |
| + } |
| +} |