This is intended to be a re-usable Puppet module that you can include in your own tree.
If you use librarian-puppet, add
the following to your Puppetfile
:
mod "jenkins",
:git => "git://github.com/jenkinsci/puppet-jenkins.git"
mod "apt",
:git => "git://github.com/puppetlabs/puppetlabs-apt.git"
mod "stdlib",
:git => "git://github.com/puppetlabs/puppetlabs-stdlib.git"
In order to add this module, run the following commands in your own, presumably Git, puppet tree:
% git submodule add git://github.com/jenkinsci/puppet-jenkins.git modules/jenkins
% git submodule update --init
This module is compatible with the puppet module tool. To build a package file
of this module, please use the rake build
task. The resulting package file
may be uploaded to the Puppet Forge.
To quickly try this module with the puppet module tool:
% rake build
% cd /etc/puppet/modules
% sudo puppet-module install /tmp/rtyler-jenkins-0.0.1.tar.gz
Installed "rtyler-jenkins-0.0.1" into directory: jenkins
% sudo puppet apply -v -e 'include jenkins'
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Applying configuration version '1323459431'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/descr: descr changed '' to 'Jenkins'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/baseurl: baseurl changed '' to 'http://pkg.jenkins-ci.org/redhat/'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/gpgcheck: gpgcheck changed '' to '1'
notice: /Stage[main]/Jenkins::Repo::El/File[/etc/yum/jenkins-ci.org.key]/ensure: defined content as '{md5}9fa06089848262c5a6383ec27fdd2575'
notice: /Stage[main]/Jenkins::Repo::El/Exec[rpm --import /etc/yum/jenkins-ci.org.key]/returns: executed successfully
notice: /Stage[main]/Jenkins::Package/Package[jenkins]/ensure: created
notice: /Stage[main]/Jenkins::Service/Service[jenkins]/ensure: ensure changed 'stopped' to 'running'
notice: Finished catalog run in 27.46 seconds
Then the service should be running at http://my.host.name:8080/.
The dependencies for this module currently are:
- stdlib module
- apt module (for Debian/Ubuntu users)
If you have any resource in Puppet that depends on Jenkins being present, add
the following require
statement:
exec {
"some-exec" :
require => Class["jenkins::package"],
# ... etc
}
The Jenkins puppet module defines the install-jenkins-plugin
resource which
will download and install the plugin "by
hand"
The names of the plugins can be found on the update site
By default, the resource will install the latest plugin, i.e.:
jenkins::plugin {
"git" : ;
}
If you need to peg a specific version, simply specify that as a string, i.e.:
jenkins::plugin {
"git" :
version => "1.1.11";
}
An example:
node /jenkins-slave.*/ {
class { 'jenkins::slave':
masterurl => 'http://jenkins-master1.domain.com:8080',
ui_user => 'adminuser',
ui_pass => 'adminpass',
}
}
node /jenkins-master.*/ {
include jenkins
jenkins::plugin {'swarm':}
}
This module has behavior tests written using RSpec 2. The goal of these tests are to validate the expected behavior of the module. As more features and platform support are added to this module the tests provide an automated way to validate the expectations previous contributors have specified.
In order to validate the behavior, please run the rake spec
task.
% rake spec
(in /Users/jeff/vms/puppet/modules/jenkins)
.
Finished in 0.31279 seconds
1 example, 0 failures
The spec tests require the rspec-puppet
gem to be installed. These tests
have initially be tested with the following integration of components in
addition to this module. Modules such as
stdlib may be checked out
into the same parent directory as this module. The spec tests will
automatically add this parent directory to the Puppet module search path.
- rspec 2.6
- rspec-puppet 0.1.0
- puppet 2.7.6
- facter 1.6.3
- stdlib 2.2.0
To install the testing requirements:
% gem install rspec-puppet --no-ri --no-rdoc
Successfully installed rspec-core-2.7.1
Successfully installed diff-lcs-1.1.3
Successfully installed rspec-expectations-2.7.0
Successfully installed rspec-mocks-2.7.0
Successfully installed rspec-2.7.0
Successfully installed rspec-puppet-0.1.0
6 gems installed
Please see the rspec-puppet project
for information on writing tests. A basic test that validates the class is
declared in the catalog is provided in the file
spec/classes/jenkins_spec.rb
. rspec-puppet
automatically uses the top
level description as the name of a module to include in the catalog.
Resources may be validated in the catalog using:
contain_class('myclass')
contain_service('sshd')
contain_file('/etc/puppet')
contain_package('puppet')
- And so forth for other Puppet resources.