Puppet Class: peering_news

Defined in:
modules/peering_news/manifests/init.pp

Overview

emailto

Peering News emails recipient.

proxy

Proxy to reach the Internet. In URL format.

config

Path to API-KEY.

Parameters:

  • emailto (Stdlib::Email) (defaults to: "root@${facts['networking']['fqdn']}")
  • config (Optional[Stdlib::Unixpath]) (defaults to: undef)
  • proxy (Optional[Stdlib::HTTPUrl]) (defaults to: undef)


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/peering_news/manifests/init.pp', line 17

class peering_news(
    Stdlib::Email              $emailto = "root@${facts['networking']['fqdn']}",
    Optional[Stdlib::Unixpath] $config  = undef,
    Optional[Stdlib::HTTPUrl]  $proxy   = undef,
) {
    file { '/usr/local/sbin/pnews':
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
        source => 'puppet:///modules/peering_news/pnews.py',
    }
    $config_cmd = $config.then |$x| { "--config ${x}" }
    $proxy_cmd = $proxy.then |$x| { "--proxy ${x}" }
    $command = "/bin/bash -c '/usr/local/sbin/pnews ${config_cmd} ${proxy_cmd} | mail -a \"Auto-Submitted: auto-generated\" -E -s \"Peering News\" ${emailto}'"
    systemd::timer::job {'peering_news':
        user        => 'root',
        description => 'Weekly Peering News in your inbox',
        splay       => 3600,
        command     => $command,
        interval    => [{'start' => 'OnCalendar', 'interval' => 'Mon *-*-* 09:00:00'},
                        {'start' => 'OnBootSec', 'interval' => '1min'}],
    }
}