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
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
|
# Class: profiles::icinga2_agent
# ==============================
#
# This class installs and configures an Icinga2 agent.
#
# Parameters
# ----------
#
# @param pki_api_user Icinga2 API user name for retrieving a
# ticket for a certificate signing request
# @param pki_api_password Icinga2 API password for retrieving a ticket
# for a certificate signing request
# @param master_host Icinga2 master hostname
# @param master_ip Icinga2 master IP address
#
# Examples
# --------
#
# @example
# class roles::myhost {
# include profiles::icinga2_agent
# }
#
# Authors
# -------
#
# Jan Dittberner <jandd@cacert.org>
#
# Copyright
# ---------
#
# Copyright 2019 Jan Dittberner
class profiles::icinga2_agent (
String $pki_api_user,
String $pki_api_password,
String $master_host,
) {
include 'profiles::icinga2_common'
file { '/var/lib/icinga2/setup_agent.sh':
ensure => file,
content => epp('profiles/icinga2_agent/setup_agent.sh.epp', {
pki_api_user => $pki_api_user,
pki_api_password => $pki_api_password,
master_host => $master_host,
}),
owner => 'nagios',
group => 'nagios',
mode => '0700',
}
#exec { '/bin/sh /var/lib/icinga2/setup_agent.sh':
# creates => "/etc/icinga2/pki/${::fqdn}.key",
# require => [
# File['/var/lib/icinga2/setup_agent.sh'],
# File['/etc/icinga2/pki/ca.crt'],
# Package['icinga2'],
# ],
#}
}
|