2012-10-26 12:36:43 -04:00
|
|
|
# == Class: jenkins::master
|
|
|
|
#
|
2012-10-01 18:53:58 -07:00
|
|
|
class jenkins::master(
|
2012-11-21 14:53:55 -05:00
|
|
|
$logo = '',
|
2012-10-26 12:36:43 -04:00
|
|
|
$vhost_name = $::fqdn,
|
|
|
|
$serveradmin = "webmaster@${::fqdn}",
|
|
|
|
$ssl_cert_file = '',
|
|
|
|
$ssl_key_file = '',
|
|
|
|
$ssl_chain_file = '',
|
|
|
|
$ssl_cert_file_contents = '', # If left empty puppet will not create file.
|
|
|
|
$ssl_key_file_contents = '', # If left empty puppet will not create file.
|
|
|
|
$ssl_chain_file_contents = '', # If left empty puppet will not create file.
|
2013-05-15 16:03:05 -07:00
|
|
|
$jenkins_ssh_private_key = '',
|
|
|
|
$jenkins_ssh_public_key = '',
|
2012-10-01 15:11:43 -07:00
|
|
|
) {
|
2012-07-23 11:54:48 -05:00
|
|
|
include pip
|
2012-08-04 10:31:59 -05:00
|
|
|
include apt
|
2012-08-04 13:10:26 -05:00
|
|
|
include apache
|
2012-07-23 11:54:48 -05:00
|
|
|
|
2013-07-16 16:33:53 -07:00
|
|
|
package { 'openjdk-7-jre-headless':
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
|
|
|
|
package { 'openjdk-6-jre-headless':
|
|
|
|
ensure => purged,
|
|
|
|
require => Package['openjdk-7-jre-headless'],
|
|
|
|
}
|
|
|
|
|
2012-02-28 11:37:20 -08:00
|
|
|
#This key is at http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key
|
2012-10-26 12:36:43 -04:00
|
|
|
apt::key { 'jenkins':
|
|
|
|
key => 'D50582E6',
|
|
|
|
key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key',
|
2012-02-28 11:37:20 -08:00
|
|
|
}
|
2012-02-11 09:12:47 -08:00
|
|
|
|
2012-08-04 10:31:59 -05:00
|
|
|
apt::source { 'jenkins':
|
2012-10-26 12:36:43 -04:00
|
|
|
location => 'http://pkg.jenkins-ci.org/debian',
|
|
|
|
release => 'binary/',
|
|
|
|
repos => '',
|
2013-07-16 16:33:53 -07:00
|
|
|
require => [
|
|
|
|
Apt::Key['jenkins'],
|
|
|
|
Package['openjdk-7-jre-headless'],
|
|
|
|
],
|
2012-08-07 13:01:23 -05:00
|
|
|
include_src => false,
|
2012-01-05 10:55:29 -08:00
|
|
|
}
|
|
|
|
|
2012-08-04 13:10:26 -05:00
|
|
|
apache::vhost { $vhost_name:
|
2012-10-26 12:36:43 -04:00
|
|
|
port => 443,
|
|
|
|
docroot => 'MEANINGLESS ARGUMENT',
|
2012-08-04 13:10:26 -05:00
|
|
|
priority => '50',
|
2012-08-04 14:30:15 -05:00
|
|
|
template => 'jenkins/jenkins.vhost.erb',
|
2012-10-26 12:36:43 -04:00
|
|
|
ssl => true,
|
2012-01-05 10:55:29 -08:00
|
|
|
}
|
2014-02-18 12:11:48 -05:00
|
|
|
if ! defined(A2mod['rewrite']) {
|
|
|
|
a2mod { 'rewrite':
|
|
|
|
ensure => present,
|
|
|
|
}
|
2012-01-05 10:55:29 -08:00
|
|
|
}
|
2014-02-18 12:11:48 -05:00
|
|
|
if ! defined(A2mod['proxy']) {
|
|
|
|
a2mod { 'proxy':
|
|
|
|
ensure => present,
|
|
|
|
}
|
2012-02-13 10:53:23 -08:00
|
|
|
}
|
2014-02-18 12:11:48 -05:00
|
|
|
if ! defined(A2mod['proxy_http']) {
|
|
|
|
a2mod { 'proxy_http':
|
|
|
|
ensure => present,
|
|
|
|
}
|
2012-02-28 11:37:20 -08:00
|
|
|
}
|
|
|
|
|
2012-10-01 18:53:58 -07:00
|
|
|
if $ssl_cert_file_contents != '' {
|
|
|
|
file { $ssl_cert_file:
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0640',
|
|
|
|
content => $ssl_cert_file_contents,
|
|
|
|
before => Apache::Vhost[$vhost_name],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $ssl_key_file_contents != '' {
|
|
|
|
file { $ssl_key_file:
|
|
|
|
owner => 'root',
|
2012-10-05 16:20:53 -07:00
|
|
|
group => 'ssl-cert',
|
2012-10-01 18:53:58 -07:00
|
|
|
mode => '0640',
|
|
|
|
content => $ssl_key_file_contents,
|
2012-10-12 15:48:55 -07:00
|
|
|
require => Package['ssl-cert'],
|
2012-10-01 18:53:58 -07:00
|
|
|
before => Apache::Vhost[$vhost_name],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $ssl_chain_file_contents != '' {
|
|
|
|
file { $ssl_chain_file:
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0640',
|
|
|
|
content => $ssl_chain_file_contents,
|
|
|
|
before => Apache::Vhost[$vhost_name],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-05 10:55:29 -08:00
|
|
|
$packages = [
|
2012-10-01 15:11:43 -07:00
|
|
|
'python-babel',
|
2012-10-21 09:53:09 -07:00
|
|
|
'python-sqlalchemy', # devstack-gate
|
2012-10-12 15:48:55 -07:00
|
|
|
'ssl-cert',
|
2012-10-29 14:39:00 -07:00
|
|
|
'sqlite3', # interact with devstack-gate DB
|
2012-01-05 10:55:29 -08:00
|
|
|
]
|
|
|
|
|
|
|
|
package { $packages:
|
2012-10-26 12:36:43 -04:00
|
|
|
ensure => present,
|
2012-08-04 10:31:59 -05:00
|
|
|
}
|
|
|
|
|
2012-10-26 12:36:43 -04:00
|
|
|
package { 'jenkins':
|
|
|
|
ensure => present,
|
2012-08-04 10:31:59 -05:00
|
|
|
require => Apt::Source['jenkins'],
|
2012-01-05 10:55:29 -08:00
|
|
|
}
|
|
|
|
|
2012-10-26 12:36:43 -04:00
|
|
|
exec { 'update apt cache':
|
|
|
|
subscribe => File['/etc/apt/sources.list.d/jenkins.list'],
|
2012-01-05 10:55:29 -08:00
|
|
|
refreshonly => true,
|
2012-10-26 12:36:43 -04:00
|
|
|
path => '/bin:/usr/bin',
|
|
|
|
command => 'apt-get update',
|
2012-01-05 10:55:29 -08:00
|
|
|
}
|
|
|
|
|
2012-10-11 15:18:03 -07:00
|
|
|
file { '/var/lib/jenkins':
|
2012-10-26 12:36:43 -04:00
|
|
|
ensure => directory,
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'adm',
|
2012-10-11 15:18:03 -07:00
|
|
|
require => Package['jenkins'],
|
|
|
|
}
|
|
|
|
|
2013-05-15 16:03:05 -07:00
|
|
|
file { '/var/lib/jenkins/.ssh/':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
|
|
|
mode => '0700',
|
|
|
|
require => File['/var/lib/jenkins'],
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/var/lib/jenkins/.ssh/id_rsa':
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
|
|
|
mode => '0600',
|
|
|
|
content => $jenkins_ssh_private_key,
|
|
|
|
replace => true,
|
|
|
|
require => File['/var/lib/jenkins/.ssh/'],
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/var/lib/jenkins/.ssh/id_rsa.pub':
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
|
|
|
mode => '0644',
|
2014-04-25 09:57:12 -07:00
|
|
|
content => "ssh_rsa ${jenkins_ssh_public_key} jenkins@${::fqdn}",
|
2013-05-15 16:03:05 -07:00
|
|
|
replace => true,
|
|
|
|
require => File['/var/lib/jenkins/.ssh/'],
|
|
|
|
}
|
|
|
|
|
2012-10-11 15:18:03 -07:00
|
|
|
file { '/var/lib/jenkins/plugins':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
|
|
|
mode => '0750',
|
|
|
|
require => File['/var/lib/jenkins'],
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/var/lib/jenkins/plugins/simple-theme-plugin':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
|
|
|
require => File['/var/lib/jenkins/plugins'],
|
2012-03-14 15:39:09 +00:00
|
|
|
}
|
|
|
|
|
2012-10-26 12:36:43 -04:00
|
|
|
file { '/var/lib/jenkins/plugins/simple-theme-plugin/openstack.css':
|
|
|
|
ensure => present,
|
2013-05-15 16:03:05 -07:00
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
2012-10-26 12:36:43 -04:00
|
|
|
source => 'puppet:///modules/jenkins/openstack.css',
|
|
|
|
require => File['/var/lib/jenkins/plugins/simple-theme-plugin'],
|
2012-03-14 15:39:09 +00:00
|
|
|
}
|
|
|
|
|
2012-10-26 12:36:43 -04:00
|
|
|
file { '/var/lib/jenkins/plugins/simple-theme-plugin/openstack.js':
|
|
|
|
ensure => present,
|
2013-05-15 16:03:05 -07:00
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
2012-10-26 12:36:43 -04:00
|
|
|
content => template('jenkins/openstack.js.erb'),
|
|
|
|
require => File['/var/lib/jenkins/plugins/simple-theme-plugin'],
|
2012-03-14 15:39:09 +00:00
|
|
|
}
|
|
|
|
|
2012-10-26 12:36:43 -04:00
|
|
|
file { '/var/lib/jenkins/plugins/simple-theme-plugin/openstack-page-bkg.jpg':
|
|
|
|
ensure => present,
|
2013-05-15 16:03:05 -07:00
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
2012-10-26 12:36:43 -04:00
|
|
|
source => 'puppet:///modules/jenkins/openstack-page-bkg.jpg',
|
|
|
|
require => File['/var/lib/jenkins/plugins/simple-theme-plugin'],
|
2012-03-14 15:39:09 +00:00
|
|
|
}
|
|
|
|
|
2013-07-23 11:59:46 -07:00
|
|
|
file { '/var/lib/jenkins/logger.conf':
|
|
|
|
ensure => present,
|
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
|
|
|
source => 'puppet:///modules/jenkins/logger.conf',
|
|
|
|
require => File['/var/lib/jenkins'],
|
|
|
|
}
|
|
|
|
|
2012-10-26 12:36:43 -04:00
|
|
|
file { '/var/lib/jenkins/plugins/simple-theme-plugin/title.png':
|
|
|
|
ensure => present,
|
2013-05-15 16:03:05 -07:00
|
|
|
owner => 'jenkins',
|
|
|
|
group => 'nogroup',
|
2012-10-26 12:36:43 -04:00
|
|
|
source => "puppet:///modules/jenkins/${logo}",
|
|
|
|
require => File['/var/lib/jenkins/plugins/simple-theme-plugin'],
|
2012-03-14 15:39:09 +00:00
|
|
|
}
|
2012-06-04 13:51:36 -07:00
|
|
|
|
2012-06-04 15:47:22 -07:00
|
|
|
file { '/usr/local/jenkins':
|
2012-10-26 12:36:43 -04:00
|
|
|
ensure => directory,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0755',
|
2012-06-04 15:47:22 -07:00
|
|
|
}
|
2012-01-05 10:55:29 -08:00
|
|
|
}
|