Puppet Class: pontoon::public_certs

Defined in:
modules/pontoon/manifests/public_certs.pp

Overview

Parameters:

  • services_config (Hash[String, Wmflib::Service])
  • public_domain (String)


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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'modules/pontoon/manifests/public_certs.pp', line 7

class pontoon::public_certs (
  Hash[String, Wmflib::Service] $services_config,
  String $public_domain,
) {
    ensure_packages('certbot')

    $public_names = $services_config.reduce([]) |$memo, $el| {
        [$service_name, $config] = $el

        if 'public_aliases' in $config {
            $aliases = $config['public_aliases'].map |$a| { "${a}.${public_domain}" }
        } else {
            $aliases = []
        }

        $memo + $aliases + "${config['public_endpoint']}.${public_domain}"
    }

    file { '/etc/apache2/sites-enabled/000-default.conf':
        source => 'puppet:///modules/pontoon/public-certs/httpd.conf',
        mode   => '0444',
        owner  => 'root',
        group  => 'root',
        notify => Service['apache2'],
    }

    file { '/etc/letsencrypt/cli.ini':
        content => template('pontoon/certbot.ini.erb'),
        notify  => Exec['certbot-certonly'],
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
    }

    file { '/etc/letsencrypt/renewal-hooks/deploy/pontoon-public-certs.sh':
        source => 'puppet:///modules/pontoon/public-certs/certbot-deploy.sh',
        mode   => '0555',
        owner  => 'root',
        group  => 'root',
    }

    exec { 'certbot-certonly':
        refreshonly => true,
        command     => '/usr/bin/certbot certonly',
    }
}