Defined Type: osm::populate_admin

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

Overview

Parameters:

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


1
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
# File 'modules/osm/manifests/populate_admin.pp', line 1

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

    $ensure_cron = $disable_admin_cron ? {
        true    => absent,
        default => $ensure,
    }
    file { $log_dir:
        ensure => directory,
        owner  => 'postgres',
        group  => 'postgres',
        mode   => '0755',
    }

    $populate_admin_cmd = "/usr/bin/psql -1Xq -d ${title} -c 'SELECT populate_admin();'"
    $grant_admin_cmd = "/usr/bin/psql -1Xq -d ${title} -f /usr/local/bin/grants-populate-admin.sql"
    cron { "populate_admin-${title}":
        ensure  => $ensure_cron,
        command => "(${populate_admin_cmd}; ${grant_admin_cmd}) >> ${log_dir}/populate_admin.log 2>&1",
        user    => 'postgres',
        weekday => $weekday,
        hour    => $hour,
        minute  => $minute,
    }
    logrotate::rule { "populate_admin-${title}":
        ensure     => $ensure_cron,
        file_glob  => "${log_dir}/populate_admin.log",
        frequency  => 'weekly',
        missing_ok => true,
        rotate     => 4,
        compress   => true,
    }

}