Puppet Class: profile::lists::automation

Defined in:
modules/profile/manifests/lists/automation.pp

Overview

SPDX-License-Identifier: Apache-2.0 automate subscribing users to certain lists introduced for steward-related lists (T351202)

Parameters:

  • data_dir (Stdlib::Unixpath) (defaults to: lookup('profile::lists::automation::data_dir', {default_value => '/srv/exports'}))
  • lists_host (Stdlib::Host) (defaults to: lookup('lists_primary_host'))
  • stewards_host (Stdlib::Host) (defaults to: lookup('stewards_primary_host'))
  • ensure (Wmflib::Ensure) (defaults to: lookup('profile::lists::automation::ensure', { default_value => 'absent' }))
  • lists_to_sync (Array[String]) (defaults to: lookup('profile::lists::automation::lists_to_sync'))


5
6
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
# File 'modules/profile/manifests/lists/automation.pp', line 5

class profile::lists::automation (
    Stdlib::Unixpath $data_dir = lookup('profile::lists::automation::data_dir', {default_value => '/srv/exports'}),
    Stdlib::Host $lists_host = lookup('lists_primary_host'),
    Stdlib::Host $stewards_host = lookup('stewards_primary_host'),
    Wmflib::Ensure $ensure = lookup('profile::lists::automation::ensure', { default_value => 'absent' }),
    Array[String] $lists_to_sync = lookup('profile::lists::automation::lists_to_sync'),
){

    wmflib::dir::mkdir_p($data_dir, {
        mode  => '0775',
    })

    systemd::timer::job { 'stewards_subscriber_data_sync':
        ensure      => $ensure,
        user        => 'root',
        description => 'copy exported stewards subscriber data from primary steward machine',
        command     => "/usr/bin/rsync --address ${lists_host} -ap rsync://${stewards_host}/steward-data-export-dir ${data_dir}",
        interval    => {'start' => 'OnCalendar', 'interval' => 'hourly'},
    }

    $list_sync_ensure = $lists_host ? {
        $::fqdn => 'present',
        default => 'absent',
    }

    each($lists_to_sync) |$list_name| {
        mailman3::sync_list_members { "sync-members-${list_name}":
            ensure    => $list_sync_ensure,
            list_name => $list_name,
        }
    }
}