Commit 07976f96 authored by Jens Langhammer's avatar Jens Langhammer

initial commit

parent ba99488a
# Run docker cleanup every hour
0 * * * * root /opt/gitlab-ci-cleanup.sh >/dev/null 2>&1
#!/bin/bash
docker rm -vf $(docker ps | tail -n +2 | grep -v gitlab-runner | awk -F" " '{print $1}') 2>/dev/null
docker rmi -f $(docker images -aq) 2>/dev/null
docker system prune -a -f 2>/dev/null
# Installs and configures a GitLab CI Runner
#
# @param ci_server_url The CI URL of the GitLab instance. Defaults to undef.
# @param ci_server_token The CI Token of the GitLab instance. Defaults to undef.
# @param runner_name The name of this runner. Defaults to $fqdn
class beryjuorg_gitlab::runner (
$ci_server_url = undef,
$ci_server_token = undef,
$runner_name = $fqdn,
) {
class {'docker':
}->
telegraf::input { 'docker':
plugin_type => 'docker',
options => {
'endpoint' => 'unix:///var/run/docker.sock',
},
}->
docker::image { 'gitlab/gitlab-runner':
ensure => latest,
}->
docker::run { 'gitlab-runner':
image => 'gitlab/gitlab-runner:latest',
volumes => [
'/var/run/docker.sock:/var/run/docker.sock',
'/srv/gitlab-runner/config:/etc/gitlab-runner'
]
}->
docker::exec { 'register':
container => 'gitlab-runner',
command => "gitlab-ci-multi-runner register -n -u \"${ci_server_url}\" -r \"${ci_server_token}\" --name \"${runner_name}\" --executor \"docker\" --docker-image \"python:3.6\" --docker-privileged",
unless => '/usr/bin/test -f /etc/gitlab-runner/config.toml',
}
file { '/etc/cron.d/gitlab-cleanup':
source => 'puppet:///modules/beryjuorg_gitlab/cleanup.cron',
owner => 'root',
group => 'root',
mode => '0755',
}->
file { '/opt/gitlab-ci-cleanup.sh':
source => 'puppet:///modules/beryjuorg_gitlab/cleanup.sh',
owner => 'root',
group => 'root',
mode => '0755',
}
}
# Install and configure gitlab-ce
class beryjuorg_gitlab::server {
apt::source { 'gitlab-ce':
location => 'http://packages.gitlab.com/gitlab/gitlab-ce/debian/',
release => $::lsbdistcodename,
repos => 'main',
key => {
'id' => '1A4C919DB987D435939638B914219A96E15E78F4',
'source' => 'https://packages.gitlab.com/gpg.key',
},
include => {
'src' => true,
'deb' => true,
}
}
package { 'gitlab-ce':
ensure => 'latest',
require => Apt::Source['gitlab-ce']
}
Firehol::Rule <<| tag == "${environment}_rp_http" |>>
firehol::service { 'influxdb':
server => 'udp/8089 tcp/8086',
}
firehol::rule { 'allow influxdb access':
service => ['influxdb'],
require => Firehol::Service['influxdb'],
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment