8250da7911
And allow zuul to send to statsd. Change-Id: Ie9f78268a673523c4ea4025bdbbe40d8d3819398 Reviewed-on: https://review.openstack.org/18658 Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Approved: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
197 lines
4.0 KiB
Puppet
197 lines
4.0 KiB
Puppet
# == Class: zuul
|
|
#
|
|
class zuul (
|
|
$vhost_name = $::fqdn,
|
|
$serveradmin = "webmaster@${::fqdn}",
|
|
$jenkins_server = '',
|
|
$jenkins_user = '',
|
|
$jenkins_apikey = '',
|
|
$gerrit_server = '',
|
|
$gerrit_user = '',
|
|
$zuul_ssh_private_key = '',
|
|
$url_pattern = '',
|
|
$status_url = "https://${::fqdn}/",
|
|
$git_source_repo = 'https://github.com/openstack-infra/zuul.git',
|
|
$push_change_refs = false,
|
|
$statsd_host = ''
|
|
) {
|
|
include apache
|
|
|
|
$packages = [
|
|
'python-webob',
|
|
'python-lockfile',
|
|
'python-paste',
|
|
]
|
|
|
|
package { $packages:
|
|
ensure => present,
|
|
}
|
|
|
|
# A lot of things need yaml, be conservative requiring this package to avoid
|
|
# conflicts with other modules.
|
|
if ! defined(Package['python-yaml']) {
|
|
package { 'python-yaml':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Package['python-paramiko']) {
|
|
package { 'python-paramiko':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Package['python-daemon']) {
|
|
package { 'python-daemon':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
package { 'statsd':
|
|
ensure => latest, # okay to use latest for pip
|
|
provider => pip,
|
|
require => Class[pip],
|
|
}
|
|
|
|
user { 'zuul':
|
|
ensure => present,
|
|
home => '/home/zuul',
|
|
shell => '/bin/bash',
|
|
gid => 'zuul',
|
|
managehome => true,
|
|
require => Group['zuul'],
|
|
}
|
|
|
|
group { 'zuul':
|
|
ensure => present,
|
|
}
|
|
|
|
# Packages that need to be installed from pip
|
|
$pip_packages = [
|
|
'GitPython',
|
|
'extras'
|
|
]
|
|
|
|
package { $pip_packages:
|
|
ensure => latest, # we want the latest from these
|
|
provider => pip,
|
|
require => Class['pip'],
|
|
}
|
|
|
|
vcsrepo { '/opt/zuul':
|
|
ensure => latest,
|
|
provider => git,
|
|
revision => 'master',
|
|
source => $git_source_repo,
|
|
}
|
|
|
|
exec { 'install_zuul' :
|
|
command => 'python setup.py install',
|
|
cwd => '/opt/zuul',
|
|
path => '/bin:/usr/bin',
|
|
refreshonly => true,
|
|
subscribe => Vcsrepo['/opt/zuul'],
|
|
}
|
|
|
|
file { '/etc/zuul':
|
|
ensure => directory,
|
|
}
|
|
|
|
# TODO: We should put in notify either Service['zuul'] or Exec['zuul-reload']
|
|
# at some point, but that still has some problems.
|
|
file { '/etc/zuul/zuul.conf':
|
|
ensure => present,
|
|
owner => 'zuul',
|
|
mode => '0400',
|
|
content => template('zuul/zuul.conf.erb'),
|
|
require => [
|
|
File['/etc/zuul'],
|
|
User['zuul'],
|
|
],
|
|
}
|
|
|
|
file { '/etc/default/zuul':
|
|
ensure => present,
|
|
mode => '0444',
|
|
content => template('zuul/zuul.default.erb'),
|
|
}
|
|
|
|
file { '/var/log/zuul':
|
|
ensure => directory,
|
|
owner => 'zuul',
|
|
require => User['zuul'],
|
|
}
|
|
|
|
file { '/var/run/zuul':
|
|
ensure => directory,
|
|
owner => 'zuul',
|
|
require => User['zuul'],
|
|
}
|
|
|
|
file { '/var/lib/zuul':
|
|
ensure => directory,
|
|
owner => 'zuul',
|
|
require => User['zuul'],
|
|
}
|
|
|
|
file { '/var/lib/zuul/git':
|
|
ensure => directory,
|
|
owner => 'zuul',
|
|
require => File['/var/lib/zuul'],
|
|
}
|
|
|
|
file { '/var/lib/zuul/ssh':
|
|
ensure => directory,
|
|
owner => 'zuul',
|
|
group => 'zuul',
|
|
mode => '0500',
|
|
require => File['/var/lib/zuul'],
|
|
}
|
|
|
|
file { '/var/lib/zuul/ssh/id_rsa':
|
|
owner => 'zuul',
|
|
group => 'zuul',
|
|
mode => '0400',
|
|
require => File['/var/lib/zuul/ssh'],
|
|
content => $zuul_ssh_private_key,
|
|
}
|
|
|
|
file { '/etc/init.d/zuul':
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0555',
|
|
source => 'puppet:///modules/zuul/zuul.init',
|
|
}
|
|
|
|
exec { 'zuul-reload':
|
|
command => '/etc/init.d/zuul reload',
|
|
require => File['/etc/init.d/zuul'],
|
|
refreshonly => true,
|
|
}
|
|
|
|
service { 'zuul':
|
|
name => 'zuul',
|
|
enable => true,
|
|
hasrestart => true,
|
|
require => File['/etc/init.d/zuul'],
|
|
}
|
|
|
|
apache::vhost { $vhost_name:
|
|
port => 443,
|
|
docroot => 'MEANINGLESS ARGUMENT',
|
|
priority => '50',
|
|
template => 'zuul/zuul.vhost.erb',
|
|
}
|
|
a2mod { 'rewrite':
|
|
ensure => present,
|
|
}
|
|
a2mod { 'proxy':
|
|
ensure => present,
|
|
}
|
|
a2mod { 'proxy_http':
|
|
ensure => present,
|
|
}
|
|
|
|
}
|