Puppet Class: psick::gitlab::runner
- Defined in:
- manifests/gitlab/runner.pp
Overview
This class manages the installation and initialisation of a GitLab CI runner.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'manifests/gitlab/runner.pp', line 17
class psick::gitlab::runner (
String $ensure = 'present',
Boolean $auto_prereq = true,
Optional[String] $template = undef,
Hash $options = { },
Hash $runners = { },
String $sudo_template = 'psick/gitlab/runner/sudo.erb',
Optional[String] $pe_user = undef,
Optional[String] $pe_password = undef,
Optional[String] $runner_user = 'gitlab-runner',
Optional[String] $pe_token_lifetime = '5y',
Boolean $use_docker = false,
) {
if $use_docker {
contain ::psick::docker
# Quick and very dirty
exec { 'usermod -a -G docker gitlab-runner':
unless => 'grep docker /etc/group | grep gitlab-runner',
subscribe => Class['psick::docker'],
}
}
$options_default = {
}
$gitlab_runner_options = $options_default + $options
::tp::install { 'gitlab-runner' :
ensure => $ensure,
auto_prereq => $auto_prereq,
}
if $template {
::tp::conf { 'gitlab-runner':
ensure => $ensure,
template => $template,
options_hash => $gitlab_runner_options,
}
}
if $runners != {} {
$runners.each | $k , $v | {
psick::gitlab::runner_register { $k:
* => $v,
}
}
}
if $sudo_template {
psick::sudo::directive { 'gitlab-runner':
template => $sudo_template,
}
}
if $pe_user and $pe_password {
psick::puppet::access { 'gitlab-runner':
pe_user => $pe_user,
pe_password => $pe_password,
run_as_user => $runner_user,
lifetime => $pe_token_lifetime,
}
}
}
|