Puppet Class: mailman3::listserve

Defined in:
modules/mailman3/manifests/listserve.pp

Overview

Class mailman3::listserve

This class provisions all the resources necessary to run the core Mailman service.

docs.mailman3.org/projects/mailman/en/latest/README.html

Parameters:

  • host (Stdlib::Fqdn)
  • db_host (Stdlib::Fqdn)
  • db_name (String)
  • db_user (String)
  • db_password (String)
  • api_password (String)
  • service_ensure (String) (defaults to: 'running')


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
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
# File 'modules/mailman3/manifests/listserve.pp', line 8

class mailman3::listserve (
    Stdlib::Fqdn $host,
    Stdlib::Fqdn $db_host,
    String $db_name,
    String $db_user,
    String $db_password,
    String $api_password,
    String $service_ensure = 'running',
) {

    ensure_packages([
        'python3-pymysql',
        'python3-mailman-hyperkitty',
    ])

    apt::package_from_component { 'mailman3':
        component => 'component/mailman3',
        packages  => [
            'mailman3',
            'python3-authheaders',
            'python3-falcon',
            'python3-flufl.bounce',
            'python3-flufl.lock',
            'python3-importlib-resources',
            'python3-zope.interface',
        ],
        require   => Package['dbconfig-no-thanks'],
    }

    file { '/etc/mailman3/mailman.cfg':
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('mailman3/mailman.cfg.erb'),
    }

    service { 'mailman3':
        ensure    => $service_ensure,
        hasstatus => false,
        pattern   => 'mailmanctl',
        subscribe => File['/etc/mailman3/mailman.cfg'],
    }

    file { '/etc/logrotate.d/mailman3':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/mailman3/logrotate.conf',
        require => Package['mailman3'],
    }

    # Helper scripts
    file { '/usr/local/sbin/remove_from_lists':
        ensure => 'present',
        owner  => 'root',
        group  => 'list',
        mode   => '0550',
        source => 'puppet:///modules/mailman3/scripts/remove_from_lists.py',
    }

    file { '/usr/local/sbin/discard_held_messages':
        ensure => 'present',
        owner  => 'root',
        group  => 'list',
        mode   => '0550',
        source => 'puppet:///modules/mailman3/scripts/discard_held_messages.py',
    }

    systemd::timer::job { 'discard_held_messages':
        ensure      => 'present',
        user        => 'root',
        description => 'discard un-moderated held messages after 90 days (T109838)',
        command     => '/usr/local/sbin/discard_held_messages 90',
        interval    => {'start' => 'OnCalendar', 'interval' => 'daily'},
    }

    file { '/usr/local/sbin/migrate_to_mailman3':
        ensure => 'present',
        owner  => 'root',
        group  => 'list',
        mode   => '0550',
        source => 'puppet:///modules/mailman3/scripts/migrate_to_mailman3.py',
    }

    file { '/var/lib/mailman3/templates/domains/':
        ensure => directory,
        owner  => 'root',
        group  => 'list',
        mode   => '0555',
    }

    file { "/var/lib/mailman3/templates/domains/${host}/":
        ensure  => directory,
        owner   => 'root',
        group   => 'list',
        mode    => '0555',
        require => File['/var/lib/mailman3/templates/domains/'],
    }

    file { "/var/lib/mailman3/templates/domains/${host}/en/":
        ensure  => directory,
        source  => 'puppet:///modules/mailman3/templates/',
        owner   => 'root',
        group   => 'list',
        mode    => '0555',
        recurse => 'remote',
        require => File["/var/lib/mailman3/templates/domains/${host}/"],
    }
}