Puppet Class: zuul::server

Defined in:
modules/zuul/manifests/server.pp

Overview

Class: zuul::server

Parameters

statsd_host

IP/hostname of a statsd daemon to send metrics to. If unset

(the default), nothing is ported.

service_ensure

Passed to systemd::service. either 'running' or 'stopped'. Default: 'running'.

service_enable

Passed to Service as 'enable'. Default: true.

Parameters:

  • gerrit_server (Any)
  • gerrit_user (Any)
  • gearman_server (Any)
  • gearman_server_start (Any)
  • url_pattern (Any)
  • service_ensure (Any) (defaults to: 'running')
  • service_enable (Any) (defaults to: true)
  • statsd_host (Any) (defaults to: '')
  • gerrit_baseurl (Any) (defaults to: 'https://gerrit.wikimedia.org/r')
  • gerrit_event_delay (Any) (defaults to: '5')
  • status_url (Any) (defaults to: "https://${::fqdn}/zuul/status")
  • email_server (Any) (defaults to: undef)
  • email_server_port (Any) (defaults to: 25)
  • email_default_from (Any) (defaults to: 'jenkins-bot@wikimedia.org')
  • email_default_to (Any) (defaults to: 'qa-alerts@lists.wikimedia.org')


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'modules/zuul/manifests/server.pp', line 32

class zuul::server (
    $gerrit_server,
    $gerrit_user,
    $gearman_server,
    $gearman_server_start,
    $url_pattern,
    $service_ensure  = 'running',
    $service_enable = true,
    $statsd_host    = '',
    $gerrit_baseurl = 'https://gerrit.wikimedia.org/r',
    $gerrit_event_delay = '5',
    $status_url     = "https://${::fqdn}/zuul/status",
    $email_server = undef,
    $email_server_port = 25,
    $email_default_from = 'jenkins-bot@wikimedia.org',
    $email_default_to = 'qa-alerts@lists.wikimedia.org',
) {

    require ::zuul

    file { '/etc/default/zuul':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('zuul/zuul.default.erb'),
    }

    # Logging configuration
    # Modification done to this file can safely trigger a daemon
    # reload via the `zuul-reload` exect provided by the `zuul`
    # puppet module..
    file { '/etc/zuul/logging.conf':
        ensure => present,
        source => 'puppet:///modules/zuul/logging.conf',
        notify => Exec['zuul-reload'],
    }

    file { '/etc/zuul/gearman-logging.conf':
        ensure => present,
        owner  => 'zuul',
        group  => 'root',
        mode   => '0444',
        source => 'puppet:///modules/zuul/gearman-logging.conf',
    }

    $zuul_role = 'server'
    file { '/etc/zuul/zuul-server.conf':
        owner   => 'zuul',
        group   => 'root',
        mode    => '0400',
        content => template('zuul/zuul.conf.erb'),
        notify  => Exec['craft public zuul conf'],

    }

    package { 'python-gear':
        # Solely for zuul-gearman.py , the server has gear embedded.
        ensure => present,
    }
    file { '/usr/local/bin/zuul-gearman.py':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0555',
        source  => 'puppet:///modules/zuul/zuul-gearman.py',
        require => Package['python-gear'],
    }

    file { '/usr/local/bin/zuul-test-repo':
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
        source => 'puppet:///modules/zuul/zuul-test-repo.py',
    }

    # Additionally provide a publicly readeable configuration file
    exec { 'craft public zuul conf':
        cwd         => '/etc/zuul/',
        command     => '/bin/sed "s/apikey=.*/apikey=<REDACTED>/" /etc/zuul/zuul-server.conf > /etc/zuul/zuul.conf',
        refreshonly => true,
    }
    file { '/etc/zuul/zuul.conf':
        owner => 'root',
        group => 'root',
        mode  => '0444',
    }

    file { '/etc/zuul/public.conf':
        ensure  => absent,
    }

    systemd::service { 'zuul':
        ensure         => 'present',
        content        => systemd_template('zuul'),
        restart        => false,
        service_params => {
            enable     => $service_enable,
            ensure     => ensure_service($service_ensure),
            hasrestart => true,
        },
        require        => [
            File['/etc/default/zuul'],
            File['/etc/zuul/zuul-server.conf'],
            File['/etc/zuul/gearman-logging.conf'],
        ],
    }

    exec { 'zuul-reload':
        command     => '/bin/systemctl reload zuul',
        refreshonly => true,
    }
}