Puppet Class: dnsrecursor::labsaliaser

Defined in:
modules/dnsrecursor/manifests/labsaliaser.pp

Overview

class: dnsrecursor::labsaliaser

Provision a script and systemd timer to setup private IP space answers for dns lookups that resolve to public ips and add other misc records.

Parameters:

  • username (Any)
  • password (Any)
  • nova_api_url (Any)
  • extra_records (Any)
  • observer_project_name (Any)


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
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
# File 'modules/dnsrecursor/manifests/labsaliaser.pp', line 5

class dnsrecursor::labsaliaser(
    $username,
    $password,
    $nova_api_url,
    $extra_records,
    $observer_project_name,
) {
    user { 'labsaliaser':
        ensure => present,
        system => true,
        home   => '/nonexistent',
        shell  => '/bin/false',
    }
    file { '/var/cache/labsaliaser':
        ensure  => directory,
        owner   => 'labsaliaser',
        group   => 'labsaliaser',
        mode    => '0644',
        require => User['labsaliaser'],
    }

    $config = {
        'username'              => $username,
        'password'              => $password,
        'output_path'           => '/var/cache/labsaliaser/labs-ip-aliases.json',
        'nova_api_url'          => $nova_api_url,
        'extra_records'         => $extra_records,
        'observer_project_name' => $observer_project_name,
    }

    file { '/etc/labs-dns-alias.yaml':
        ensure  => present,
        owner   => 'labsaliaser',
        group   => 'labsaliaser',
        mode    => '0440',
        content => to_yaml($config),
    }

    package { 'lua-json':
        ensure => present,
    }

    file { '/usr/local/bin/labs-ip-alias-dump.py':
        ensure => present,
        owner  => 'labsaliaser',
        group  => 'labsaliaser',
        mode   => '0550',
        source => 'puppet:///modules/dnsrecursor/labs-ip-alias-dump.py',
    }

    file { '/usr/local/bin/labsalias-dump.sh':
        ensure  => absent,
    }

    systemd::timer::job { 'labs-ip-alias-dump':
        ensure          => 'present',
        # Don't log to file, use journald
        logging_enabled => false,
        user            => 'root',
        description     => 'Update the mapping that splits internal and external DNS for Cloud VPS instances',
        command         => '/usr/local/bin/labs-ip-alias-dump.py',
        interval        => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* *:30:00', # hourly at half-past
        },
        require         => File[
            '/usr/local/bin/labs-ip-alias-dump.py',
            '/etc/labs-dns-alias.yaml'
        ],
    }
}