Jenkins : Puppet

It may be desirable to automate and manage your Jenkins instance with Puppet.

Ubuntu + Jenkins repository

This class depends on the 'apt' Puppet module at https://github.com/camptocamp/puppet-apt.

class jenkins {
    include apt

    apt::key {
      'D50582E6':
        source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key',
    }

    apt::sources_list {
      'jenkins':
        ensure  => present,
        content => 'deb http://pkg.jenkins-ci.org/debian-stable binary/',
        # The above gives you the LTS release. Use the below repo to get the very latest
        # content => 'deb http://pkg.jenkins-ci.org/debian binary/',
        require => Apt::Key['D50582E6'],
    }

    package {
      'jenkins':
        ensure  => installed,
        require => Apt::Sources_list['jenkins'],
    }

    service {
      'jenkins':
        ensure  => running,
        enable  => true,
        require => Package['jenkins'],
    }
}

RPM/DEB/etc over HTTP 

An even simpler solution is to simply install a specific version via rpm/deb over http:

class jenkins {
    package {"jenkins":
        ensure  => "installed",
        provider => "rpm",
        source => "http://pkg.jenkins-ci.org/redhat/jenkins-1.460-1.1.noarch.rpm",
    }

    service {"jenkins":
        enable  => true,
        ensure  => "running",
        hasrestart=> true,
        require => Package["jenkins"],
    }
}

This solution provides more consistent puppet runs as the Jenkins version won't change over time. Note that this solution depends on pkg.jenkins-ci.org being up during the puppet run, so it would be recommended to host the package on your own server or an S3 bucket if that is a concern for you.