Puppet Class: dnsrecursor::labsaliaser

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

Overview

class: dnsrecursor::labsaliaser

Provision a script and cron job 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
# 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   => 'root',
        group   => 'root',
        mode    => '0440',
        content => ordered_yaml($config),
    }

    package { 'lua-json':
        ensure => present,
    }
    file { '/usr/local/bin/labs-ip-alias-dump.py':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0550',
        source  => 'puppet:///modules/dnsrecursor/labs-ip-alias-dump.py',
        require => [
            Package['lua-json'],
            File['/var/cache/labsaliaser'],
        ],
    }

    cron { 'labs-ip-alias-dump':
        ensure  => 'present',
        user    => 'labsaliaser',
        command => 'if ! `/usr/local/bin/labs-ip-alias-dump.py --check-changes-only`; then /usr/local/bin/labs-ip-alias-dump.py; /usr/bin/rec_control reload-lua-script; fi  > /dev/null 2>&1',
        minute  => 30,
        require => File[
            '/usr/local/bin/labs-ip-alias-dump.py',
            '/etc/labs-dns-alias.yaml'
        ],
    }
}