Puppet Class: puppetmaster::puppetdb::client

Defined in:
modules/puppetmaster/manifests/puppetdb/client.pp

Overview

Class puppetmaster::puppetdb::client

Configures a puppetmaster to work as a puppetdb client

Parameters:

  • hosts (Array[Stdlib::Host])
  • port (Stdlib::Port) (defaults to: 443)
  • command_broadcast (Boolean) (defaults to: false)


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
41
42
# File 'modules/puppetmaster/manifests/puppetdb/client.pp', line 3

class puppetmaster::puppetdb::client(
    Array[Stdlib::Host] $hosts,
    Stdlib::Port        $port              = 443,
    Boolean             $command_broadcast = false,
) {
    $puppetdb_terminus_package = os_version('debian >= buster') ? {
        true    => 'puppet-terminus-puppetdb',
        default => 'puppetdb-termini',
    }
    $puppetdb_conf_template    = 'puppetmaster/puppetdb4.conf.erb'

    require_package($puppetdb_terminus_package)

    file { '/etc/puppet/puppetdb.conf':
        ensure  => present,
        content => template($puppetdb_conf_template),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }

    file { '/etc/puppet/routes.yaml':
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
        source => 'puppet:///modules/puppetmaster/routes.yaml',
    }

    if defined(Service['apache2']) {
        File['/etc/puppet/routes.yaml'] -> Service['apache2']
    }

    # Absence of this directory causes the puppetmaster to spit out
    # 'Removing mount "facts": /var/lib/puppet/facts does not exist or is not a directory'
    # and catalog compilation to fail with https://tickets.puppetlabs.com/browse/PDB-949
    file { '/var/lib/puppet/facts':
        ensure => directory,
    }
}