Puppet Class: profile::discovery::client

Defined in:
modules/profile/manifests/discovery/client.pp

Overview

Class profile::discovery::client

Will use confd to watch our discovery system and save the result as a json file in a chosen directory.

Parameters

path

The directory where the file should go.

watch_interval

The interval in seconds for checks on etcd. Defaults to 5

Parameters:

  • path (Any) (defaults to: hiera('profile::discovery::path'))


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
# File 'modules/profile/manifests/discovery/client.pp', line 11

class profile::discovery::client(
    $path=hiera('profile::discovery::path'),
){
    # We need confd
    require ::profile::conftool::state
    file { $path:
        ensure => directory,
        owner  => root,
        group  => root,
        mode   => '0755',
    }

    confd::file { "${path}/discovery-basic.yaml":
        ensure     => present,
        content    => template('profile/discovery/basic.yaml.tpl.erb'),
        watch_keys => ['/'],
        prefix     => '/discovery',
        mode       => '0444',
        check      => 'ruby -e \"require \'yaml\'; YAML.load_file(\'{{ .src }}\')\"',
    }

    confd::file { "${path}/services.yaml":
        ensure     => present,
        content    => template('profile/discovery/services.yaml.tpl.erb'),
        watch_keys => ['/'],
        prefix     => '/services',
        mode       => '0444',
    }
}