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_enable

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

service_ensure

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

Parameters:

  • gerrit_server (Stdlib::Host)
  • gerrit_user (String)
  • gearman_server (Stdlib::Host)
  • gearman_server_start (Boolean)
  • url_pattern (String)
  • service_enable (Wmflib::Enable_Service) (defaults to: true)
  • service_ensure (Stdlib::Ensure::Service) (defaults to: 'running')
  • statsd_host (Optional[Stdlib::Host]) (defaults to: undef)
  • gerrit_baseurl (Stdlib::HTTPUrl) (defaults to: 'https://gerrit.wikimedia.org/r')
  • gerrit_event_delay (Integer) (defaults to: 5)
  • status_url (Stdlib::HTTPUrl) (defaults to: "https://${facts['fqdn']}/zuul/status")
  • email_server (Optional[Stdlib::Host]) (defaults to: undef)
  • email_server_port (Stdlib::Port) (defaults to: 25)
  • email_default_from (String) (defaults to: 'releng@lists.wikimedia.org')
  • email_default_to (String) (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
146
147
148
# File 'modules/zuul/manifests/server.pp', line 32

class zuul::server (
    Stdlib::Host            $gerrit_server,
    String                  $gerrit_user,
    Stdlib::Host            $gearman_server,
    Boolean                 $gearman_server_start,
    String                  $url_pattern,
    Wmflib::Enable_Service  $service_enable     = true,
    Stdlib::Ensure::Service $service_ensure     = 'running',
    Optional[Stdlib::Host]  $statsd_host        = undef,
    Stdlib::HTTPUrl         $gerrit_baseurl     = 'https://gerrit.wikimedia.org/r',
    Integer                 $gerrit_event_delay = 5,
    Stdlib::HTTPUrl         $status_url         = "https://${facts['fqdn']}/zuul/status",
    Optional[Stdlib::Host]  $email_server       = undef,
    Stdlib::Port            $email_server_port  = 25,
    String                  $email_default_from = 'releng@lists.wikimedia.org',
    String                  $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'
    $gearman_server_ip = ipresolve($gearman_server, 4)

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

    }

    # That was solely for zuul-gearman.py , the server has gear embedded.
    package { 'python3-gear':
        ensure => absent,
    }
    file { '/usr/local/bin/zuul-gearman.py':
        ensure  => absent,
    }

    # `gearadmin` to issue administrative commands
    # `gearman` a client and worker
    package { 'gearman-tools':
        ensure => present,
    }

    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     => $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,
    }
}