Defined Type: osm::populate_admin

Defined in:
modules/osm/manifests/populate_admin.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: present)
  • disable_admin_timer (Boolean) (defaults to: false)
  • hour (Integer) (defaults to: 0)
  • minute (Integer) (defaults to: 1)
  • weekday (String) (defaults to: 'Tue')
  • log_dir (String) (defaults to: '/var/log/osm')


2
3
4
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
37
38
39
40
41
42
43
44
45
46
47
48
# File 'modules/osm/manifests/populate_admin.pp', line 2

define osm::populate_admin (
    Wmflib::Ensure $ensure       = present,
    Boolean $disable_admin_timer = false,
    Integer $hour                = 0,
    Integer $minute              = 1,
    String $weekday              = 'Tue',
    String $log_dir              = '/var/log/osm'
) {

    $ensure_timer = $disable_admin_timer ? {
        true    => absent,
        default => $ensure,
    }

    file { $log_dir:
        ensure => directory,
        owner  => 'postgres',
        group  => 'postgres',
        mode   => '0755',
    }

    file { '/usr/local/bin/osm_populate_admin.sh':
        ensure  => directory,
        owner   => 'postgres',
        group   => 'postgres',
        mode    => '0755',
        content => template('osm/osm_populate_admin'),
    }

    systemd::timer::job { "populate_admin-${title}":
        ensure      => $ensure_timer,
        description => 'Ensure correct grants in Postgresql for OSM',
        command     => '/usr/local/bin/osm_populate_admin.sh',
        user        => 'postgres',
        interval    => {'start' => 'OnCalendar', 'interval' => "${weekday} *-*-* ${hour}:${minute}:00"}
    }

    logrotate::rule { "populate_admin-${title}":
        ensure     => $ensure_timer,
        file_glob  => "${log_dir}/populate_admin.log",
        frequency  => 'weekly',
        missing_ok => true,
        rotate     => 4,
        compress   => true,
    }

}