summaryrefslogtreecommitdiff
path: root/manifests/register.pp
blob: 14019d025a3692f3b5be031a6e06f7fb6281728d (plain)
1
2
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
define munin::register (
  $host = 'absent',
  $port = 'absent',
  $description = 'absent',
  $config = []
)
{
  $fhost = $name
  $client_type = 'client'

  $munin_port_real = $port ? {
    'absent' => hiera('munin_port','4949'),
    default => $port
  }

  $hiera_munin_host = hiera('munin_host','')
  $munin_host_real = $host ? {
    'absent' =>  $hiera_munin_host ? {
      '' => $::fqdn,
      'fqdn' => $::fqdn,
      default => $hiera_munin_host
    },
    default => $host
  }

  @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}":
    target => '/etc/munin/munin.conf',
    content => template("munin/client.erb"),
    tag => 'munin',
  }
}