Customize jenkins.default by template
Turn jenkins.default to a template. This enables to customize it easily. This is useful for downstream projects where it is needed to tune jenkins.default parameters. Either Pass the required parameter to jenkins class or pass a customized jenkins.default file location in jenkins_default. For backward compatibility, default values are set in the class parameters list. Change-Id: Ice0e4ffa2fffd041d8bcc4a0b323ffae7ba2b0c8
This commit is contained in:
parent
5991ee6a62
commit
89d89683e3
@ -1,5 +1,15 @@
|
|||||||
# == Class: jenkins::master
|
# == Class: jenkins::master
|
||||||
#
|
#
|
||||||
|
# This class will install and configure Jenkins master
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*jenkins_default*]
|
||||||
|
# (Optional) Puppet source from which to initialize /etc/defaults/jenkins.
|
||||||
|
# E.g. 'puppet:///modules/<yourmodule/jenkins.default'. If specified,
|
||||||
|
# java_args_override, run_standalone, max_open_files, and http_port are
|
||||||
|
# ignored.
|
||||||
|
|
||||||
class jenkins::master(
|
class jenkins::master(
|
||||||
$logo = '',
|
$logo = '',
|
||||||
$vhost_name = $::fqdn,
|
$vhost_name = $::fqdn,
|
||||||
@ -12,9 +22,13 @@ class jenkins::master(
|
|||||||
$ssl_chain_file_contents = '', # If left empty puppet will not create file.
|
$ssl_chain_file_contents = '', # If left empty puppet will not create file.
|
||||||
$jenkins_ssh_private_key = '',
|
$jenkins_ssh_private_key = '',
|
||||||
$jenkins_ssh_public_key = '',
|
$jenkins_ssh_public_key = '',
|
||||||
$jenkins_default = 'puppet:///modules/jenkins/jenkins.default',
|
$jenkins_default = undef,
|
||||||
$jenkins_version = 'present',
|
$jenkins_version = 'present',
|
||||||
|
$java_args_override = undef,
|
||||||
$jenkins_deb_url_base = 'http://pkg.jenkins.io/debian/binary',
|
$jenkins_deb_url_base = 'http://pkg.jenkins.io/debian/binary',
|
||||||
|
$run_standalone = true,
|
||||||
|
$max_open_files = 8192,
|
||||||
|
$http_port = 8080,
|
||||||
) {
|
) {
|
||||||
include ::pip
|
include ::pip
|
||||||
include ::apt
|
include ::apt
|
||||||
@ -156,12 +170,27 @@ class jenkins::master(
|
|||||||
command => 'apt-get update',
|
command => 'apt-get update',
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/default/jenkins':
|
# Template uses:
|
||||||
ensure => present,
|
# - $java_args_override
|
||||||
owner => 'root',
|
# - $run_standalone
|
||||||
group => 'root',
|
# - $max_open_files
|
||||||
mode => '0644',
|
# - $http_port
|
||||||
source => $jenkins_default,
|
if ! $jenkins_default {
|
||||||
|
file { '/etc/default/jenkins':
|
||||||
|
ensure => present,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
content => template('jenkins/jenkins.default.erb'),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file { '/etc/default/jenkins':
|
||||||
|
ensure => present,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
source => $jenkins_default
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/var/lib/jenkins':
|
file { '/var/lib/jenkins':
|
||||||
|
@ -11,7 +11,11 @@ JAVA=/usr/bin/java
|
|||||||
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address
|
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address
|
||||||
# Disable compression as zip deflation threads eat CPU time.
|
# Disable compression as zip deflation threads eat CPU time.
|
||||||
# https://issues.jenkins-ci.org/browse/JENKINS-14362
|
# https://issues.jenkins-ci.org/browse/JENKINS-14362
|
||||||
|
<% if @java_args_override -%>
|
||||||
|
JAVA_ARGS="<%= @java_args_override %>"
|
||||||
|
<% else -%>
|
||||||
JAVA_ARGS="-Xloggc:/var/log/jenkins/gc.log -XX:+PrintGCDetails -Xmx12g -Dorg.kohsuke.stapler.compression.CompressionFilter.disabled=true -Djava.util.logging.config.file=/var/lib/jenkins/logger.conf"
|
JAVA_ARGS="-Xloggc:/var/log/jenkins/gc.log -XX:+PrintGCDetails -Xmx12g -Dorg.kohsuke.stapler.compression.CompressionFilter.disabled=true -Djava.util.logging.config.file=/var/lib/jenkins/logger.conf"
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
PIDFILE=/var/run/jenkins/jenkins.pid
|
PIDFILE=/var/run/jenkins/jenkins.pid
|
||||||
|
|
||||||
@ -27,7 +31,7 @@ JENKINS_HOME=/var/lib/jenkins
|
|||||||
# set this to false if you don't want Hudson to run by itself
|
# set this to false if you don't want Hudson to run by itself
|
||||||
# in this set up, you are expected to provide a servlet container
|
# in this set up, you are expected to provide a servlet container
|
||||||
# to host jenkins.
|
# to host jenkins.
|
||||||
RUN_STANDALONE=true
|
RUN_STANDALONE=<%= @run_standalone %>
|
||||||
|
|
||||||
# log location. this may be a syslog facility.priority
|
# log location. this may be a syslog facility.priority
|
||||||
JENKINS_LOG=/var/log/jenkins/$NAME.log
|
JENKINS_LOG=/var/log/jenkins/$NAME.log
|
||||||
@ -38,10 +42,10 @@ JENKINS_LOG=/var/log/jenkins/$NAME.log
|
|||||||
# this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e
|
# this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e
|
||||||
# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
|
# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
|
||||||
# descriptors are forced to 1024 regardless of /etc/security/limits.conf
|
# descriptors are forced to 1024 regardless of /etc/security/limits.conf
|
||||||
MAXOPENFILES=8192
|
MAXOPENFILES=<%= @max_open_files %>
|
||||||
|
|
||||||
# port for HTTP connector (default 8080; disable with -1)
|
# port for HTTP connector (default 8080; disable with -1)
|
||||||
HTTP_PORT=8080
|
HTTP_PORT=<%= @http_port %>
|
||||||
|
|
||||||
# port for AJP connector (disabled by default)
|
# port for AJP connector (disabled by default)
|
||||||
AJP_PORT=-1
|
AJP_PORT=-1
|
Loading…
x
Reference in New Issue
Block a user