system-config/modules/jenkins_master/manifests/init.pp
James E. Blair 695ee3f4dc Make jenkins vhost config more like gerrit.
Take full filename parameters for SSL files, to better accomodate
dev sites.

Rename apache.conf.erb to jenkins.vhost.erb, because it's actually
a vhost config, not the apache.conf (which is a different file).

Change-Id: I0cf9857fd8860c199081f50ead7218b09955cfab
2012-04-24 11:05:43 -07:00

171 lines
4.6 KiB
Puppet

class jenkins_master($site, $serveradmin, $logo,
$ssl_cert_file='',
$ssl_key_file='',
$ssl_chain_file=''
) {
#This key is at http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key
apt::key { "D50582E6":
keyid => "D50582E6",
ensure => present,
}
file { '/etc/apt/sources.list.d/jenkins.list':
owner => 'root',
group => 'root',
mode => 444,
ensure => 'present',
content => "deb http://pkg.jenkins-ci.org/debian binary/",
replace => 'true',
require => Apt::Key['D50582E6'],
}
file { '/etc/apache2/sites-available/jenkins':
owner => 'root',
group => 'root',
mode => 444,
ensure => 'present',
content => template("jenkins_master/jenkins.vhost.erb"),
replace => 'true',
require => Package['apache2'],
}
file { '/etc/apache2/sites-enabled/jenkins':
target => '/etc/apache2/sites-available/jenkins',
ensure => link,
require => [
File['/etc/apache2/sites-available/jenkins'],
File['/etc/apache2/mods-enabled/ssl.conf'],
File['/etc/apache2/mods-enabled/ssl.load'],
File['/etc/apache2/mods-enabled/rewrite.load'],
File['/etc/apache2/mods-enabled/proxy.conf'],
File['/etc/apache2/mods-enabled/proxy.load'],
File['/etc/apache2/mods-enabled/proxy_http.load'],
],
}
file { '/etc/apache2/sites-enabled/000-default':
require => File['/etc/apache2/sites-available/jenkins'],
ensure => absent,
}
file { '/etc/apache2/mods-enabled/ssl.conf':
target => '/etc/apache2/mods-available/ssl.conf',
ensure => link,
require => Package['apache2'],
}
file { '/etc/apache2/mods-enabled/ssl.load':
target => '/etc/apache2/mods-available/ssl.load',
ensure => link,
require => Package['apache2'],
}
file { '/etc/apache2/mods-enabled/rewrite.load':
target => '/etc/apache2/mods-available/rewrite.load',
ensure => link,
require => Package['apache2'],
}
file { '/etc/apache2/mods-enabled/proxy.conf':
target => '/etc/apache2/mods-available/proxy.conf',
ensure => link,
require => Package['apache2'],
}
file { '/etc/apache2/mods-enabled/proxy.load':
target => '/etc/apache2/mods-available/proxy.load',
ensure => link,
require => Package['apache2'],
}
file { '/etc/apache2/mods-enabled/proxy_http.load':
target => '/etc/apache2/mods-available/proxy_http.load',
ensure => link,
require => Package['apache2'],
}
$packages = [
"jenkins",
"python-pip",
"python-babel",
"apache2"
]
package { $packages:
ensure => "latest",
require => [File['/etc/apt/sources.list.d/jenkins.list'], Exec["update apt cache"]],
}
service { "versions":
provider => upstart,
ensure => running,
}
file { '/etc/init/versions.conf':
owner => 'root',
group => 'root',
mode => 444,
ensure => 'present',
source => "puppet:///modules/jenkins_master/versions.conf",
replace => 'true',
notify => Service["versions"]
}
package { "apache-libcloud":
ensure => latest,
provider => pip,
require => Package[python-pip]
}
package { "git-review":
ensure => latest,
provider => pip,
require => Package[python-pip]
}
exec { "update apt cache":
subscribe => [ File["/etc/apt/sources.list.d/jenkins.list"]],
refreshonly => true,
path => "/bin:/usr/bin",
command => "apt-get update",
}
exec { "gracefully restart apache":
subscribe => [ File["/etc/apache2/sites-available/jenkins"]],
refreshonly => true,
path => "/bin:/usr/bin:/usr/sbin",
command => "apache2ctl graceful",
}
file { "/var/lib/jenkins/plugins/simple-theme-plugin":
ensure => directory,
owner => 'jenkins',
group => 'nogroup'
}
file { "/var/lib/jenkins/plugins/simple-theme-plugin/openstack.css":
ensure => present,
source => "puppet:///modules/jenkins_master/openstack.css",
require => File["/var/lib/jenkins/plugins/simple-theme-plugin"]
}
file { "/var/lib/jenkins/plugins/simple-theme-plugin/openstack.js":
ensure => present,
content => template("jenkins_master/openstack.js.erb"),
require => File["/var/lib/jenkins/plugins/simple-theme-plugin"]
}
file { "/var/lib/jenkins/plugins/simple-theme-plugin/openstack-page-bkg.jpg":
ensure => present,
source => "puppet:///modules/jenkins_master/openstack-page-bkg.jpg",
require => File["/var/lib/jenkins/plugins/simple-theme-plugin"]
}
file { "/var/lib/jenkins/plugins/simple-theme-plugin/title.png":
ensure => present,
source => "puppet:///modules/jenkins_master/${logo}",
require => File["/var/lib/jenkins/plugins/simple-theme-plugin"]
}
}