Puppet Class: mailman3::listserve
- Defined in:
- modules/mailman3/manifests/listserve.pp
Overview
SPDX-License-Identifier: Apache-2.0
Class mailman3::listserve
This class provisions all the resources necessary to run the core Mailman service.
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 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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'modules/mailman3/manifests/listserve.pp', line 9
class mailman3::listserve (
Stdlib::Fqdn $host,
Stdlib::Fqdn $db_host,
String $db_name,
String $db_user,
String $db_password,
String $api_password,
Wmflib::Ensure $service_ensure = 'present',
) {
ensure_packages([
'python3-pymysql',
'python3-mailman-hyperkitty',
])
$mailman3_debs = [
'mailman3',
'python3-authheaders',
'python3-falcon',
'python3-flufl.bounce',
'python3-flufl.lock',
'python3-importlib-resources',
'python3-zope.interface',
]
# Use stock mailman3 in bookworm and newer
if debian::codename::ge('bookworm') {
ensure_packages($mailman3_debs)
} else {
apt::package_from_component { 'mailman3':
component => 'component/mailman3',
packages => $mailman3_debs,
}
}
Package['dbconfig-no-thanks'] ~> Package['mailman3']
file { '/etc/mailman3/mailman.cfg':
owner => 'root',
group => 'root',
mode => '0444',
content => template('mailman3/mailman.cfg.erb'),
}
service { 'mailman3':
ensure => stdlib::ensure($service_ensure, 'service'),
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 => $service_ensure,
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,
owner => 'root',
group => 'list',
mode => '0555',
require => File["/var/lib/mailman3/templates/domains/${host}/"],
}
$templates = [
'domain_admin_notice_new-list.txt',
'help.txt',
'list_admin_action_post.txt',
'list_admin_action_subscribe.txt',
'list_admin_action_unsubscribe.txt',
'list_admin_notice_disable.txt',
'list_admin_notice_removal.txt',
'list_admin_notice_subscribe.txt',
'list_admin_notice_unrecognized.txt',
'list_admin_notice_unsubscribe.txt',
'list_member_digest_header.txt',
'list_member_digest_masthead.txt',
'list_member_generic_footer.txt',
'list_member_regular_header.txt',
'list_user_action_invite.txt',
'list_user_action_subscribe.txt',
'list_user_action_unsubscribe.txt',
'list_user_notice_goodbye.txt',
'list_user_notice_hold.txt',
'list_user_notice_no-more-today.txt',
'list_user_notice_post.txt',
'list_user_notice_probe.txt',
'list_user_notice_refuse.txt',
'list_user_notice_rejected.txt',
'list_user_notice_warning.txt',
'list_user_notice_welcome.txt'
]
$templates.each |String $template| {
$dest_filename = regsubst($template, /_/, ':', 'G')
file { "/var/lib/mailman3/templates/domains/${host}/en/${dest_filename}":
ensure => file,
source => "puppet:///modules/mailman3/templates/${template}",
owner => 'root',
group => 'list',
mode => '0555',
require => File["/var/lib/mailman3/templates/domains/${host}/en"],
}
}
}
|