Puppet Class: jenkins::slave

Defined in:
modules/jenkins/manifests/slave.pp

Overview

Class: jenkins::slave

Parameters:

  • ssh_key (String)
  • user (String) (defaults to: 'jenkins-slave')
  • workdir (Stdlib::Unixpath) (defaults to: '/var/lib/jenkins-slave')


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'modules/jenkins/manifests/slave.pp', line 3

class jenkins::slave(
    String $ssh_key,
    String $user = 'jenkins-slave',
    Stdlib::Unixpath $workdir = '/var/lib/jenkins-slave',
) {

    ensure_packages('default-jre-headless')

    group { $user:
        ensure => present,
        name   => $user,
    }

    user { $user:
        ensure     => present,
        shell      => '/bin/bash',
        managehome => true,
        system     => true,
        home       => '/var/lib/jenkins-slave',
    }

    file { $workdir:
        ensure  => directory,
        owner   => $user,
        group   => $user,
        mode    => '0775',
        require => User[$user],
    }

    # Finally publish the Jenkins master authorized key
    ssh::userkey { $user:
        ensure  => present,
        content => $ssh_key,
    }
}