Forge Home

jenkins

This module will install the latest jenkins v2

14,149 downloads

14,149 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.0 (latest)
released Dec 17th 2017
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 6.0.0
  • , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gutocarvalho-jenkins', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gutocarvalho-jenkins
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gutocarvalho-jenkins --version 1.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

gutocarvalho/jenkins — version 1.0.0 Dec 17th 2017

Build Status License Version Downloads

jenkins

Table of contents

  1. Overview
  2. Supported Platforms
  3. Requirements
  4. Installation
  5. Usage
  6. References
  7. Development

Overview

This module will install the latest jenkins 2 series in your system.

This module can also configure SSL for Jenkins.

This is a very simple module, usually used for development and test purposes.

Yes, you can use it in production, but it is a simple module, you may miss some parameters for production use.

The main objective is to install jenkins with minimal intervention in the default files.

Augeas resource type is used to change parameters inside the /etc/sysconfig/jenkins.

Supported Platforms

This module was tested under these platforms

  • EL 6 and 7

Tested only in X86_64 arch.

Requirements

  • Puppet >= 5.0.0
  • Hiera >= 3.4 (v5 format)

Installation

via git

# cd /etc/puppetlabs/code/environment/production/modules
# git clone https://github.com/gutocarvalho/puppet-jenkins.git jenkins

via puppet

# puppet module install gutocarvalho/jenkins

via puppetfile

mod 'gutocarvalho-jenkins', '1.0.0'

Usage

Quick run

puppet apply -e "include jenkins"

Using with parameters

Example in EL 7 with no SSL

class { 'jenkins':
  http_listen_address     => '192.168.250.80',
  http_port               => 8080,
}

Example in EL 7 with SSL enabled

## first generate a certificate
## puppet cert generate jenkins.hacklab

java_ks { 'jenkins_keystore_base':
  ensure       => latest,
  certificate  => '/etc/puppetlabs/puppet/ssl/certs/ca.pem',
  target       => '/opt/jenkins.ks',
  password     => 'puppet',
  trustcacerts => true,
}

java_ks { 'jenkins_keystore_certs':
  ensure              => latest,
  certificate         => '/etc/puppetlabs/puppet/ssl/certs/jenkins.hacklab.pem',
  private_key         => '/etc/puppetlabs/puppet/ssl/private_keys/jenkins.hacklab.pem',
  private_key_type    => 'rsa',
  target              => '/opt/jenkins.ks',
  password            => 'puppet',
  password_fail_reset => true,
}

class { 'jenkins':
  enable_https            => true,
  http_listen_address     => '192.168.250.80',
  https_listen_address    => '192.168.250.80',
  http_port               => 8080,
  https_port              => 8081,
  https_keystore          => '/opt/jenkins.ks',
  https_keystore_password => 'puppet',
}

## now you can access
##   access https://jenkins.hacklab:8081

References

Classes

jenkins
jenkins::install (private)
jenkins::config (private)
jenkins::service (private)

Parameters type

homedir

Type: String

Directory where Jenkins store its configuration and working

version

Type: String

The jenkins package version. ( 2.95-1.1.noarch | installed | latest )

user

Type: String

Unix user account that runs the Jenkins daemon

http_listen_address

Type: String

IP address Jenkins listens on for HTTPS requests

debug

Type: Integer

Debug level for logs.

handler_max

Type: Integer

Maximum number of HTTP worker threads

handler_idle

Type: Integer

Maximum number of idle HTTP worker threads

java_args

Type: String

Options to pass to java when running Jenkins

http_port

Type: Integer

HTTP port Jenkins is listening on

https_port

Type: Integer

HTTPS port Jenkins is listening on

https_listen_address

Type: String

IP address Jenkins listens on for HTTPS requests

enable_access_log

Type: String

Whether to enable access logging or not ( yes | no )

enable_https

Type: Boolean

Whether to enable access logging or not

https_keystore

Type: String

Path to the keystore in JKS format (as created by the JDK 'keytool')

https_keystore_password

Type: String

Password to access the keystore defined in https_keystore

args

Type: String

Pass arbitrary arguments to Jenkins

java_cmd

Type: String

Java executable to run Jenkins

Hiera Keys

---
jenkins::homedir: '/var/lib/jenkins'
jenkins::java_args: '-Xms1g -Xmx1g -XX:MaxPermSize=256m'
jenkins::version: 'installed'
jenkins::user: 'jenkins'
jenkins::http_listen_address: '0.0.0.0'
jenkins::http_port: 8080
jenkins::enable_access_log: 'no'

jenkins::debug: 5
jenkins::handler_max: 100
jenkins::handler_idle: 20

jenkins::enable_https: true
jenkins::https_port: 8081
jenkins::https_listen_address: '0.0.0.0'
jenkins::https_keystore: '/opt/jenkins.ks'
jenkins::https_keystore_password: 'puppet'

Hiera module config

This is the Hiera v5 configuration inside the module.

This module does not have params class, everything is under hiera v5.

---
version: 5
defaults:
  datadir: data
  data_hash: yaml_data
hierarchy:
  - name: "OSes"
    paths:
     - "oses/distro/%{facts.os.name}/%{facts.os.release.major}.yaml"
     - "oses/family/%{facts.os.family}.yaml"

  - name: "common"
    path: "common.yaml"

This is an example of files under modules/jenkins/data

oses/family/RedHat.yaml
oses/family/Debian.yaml
oses/distro/CentOS/7.yaml
oses/distro/CentOS/6.yaml
oses/distro/Ubuntu/16.04.yaml
oses/distro/Debian/8.yaml

Development

My dev environment

This module was developed using

  • Puppet 5.3
    • Hiera 3.4 (v5 format)
    • Facter 3.9
  • CentOS 7
  • Vagrant 2.0
    • box: gutocarvalho/centos7x64puppet5

Testing

This module uses puppet-lint, puppet-syntax, metadata-json-lint, rspec-puppet, beaker and travis-ci. We hope you use them before submitting your PR.

Installing gems

gem install bundler --no-rdoc --no-ri
bundle install --without development

Running syntax tests

bundle exec rake syntax
bundle exec rake lint
bundle exec rake metadata_lint

Running unit tests

bundle exec rake spec

Running acceptance tests

Acceptance tests (Beaker) can be executed using ./acceptance.sh. There is a matrix 1/5 to test this class under Centos 6/7, Debian 8 and Ubuntu 14.04/16.04.

bash ./acceptance.sh

If you want a detailed output, set this before run acceptance.sh

export BEAKER_debug=true

If you want to test a specific OS from our matrix

BEAKER_set=centos-6-x64 bundle exec rake beaker

Our matrix values

centos-6-x64
centos-7-x64
debian-8-x64
ubuntu-1604-x64

This matrix needs vagrant (>=1.9) and virtualbox (>=5.1) to work properly, make sure that you have both of them installed.

Author/Contributors

Guto Carvalho (gutocarvalho at gmail dot com)