-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcurrent.pp
110 lines (103 loc) · 3.04 KB
/
current.pp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# @summary
# The current style deployment for Red Hat 6.10+ and Red Hat 7.5+.
#
# @param package_name
# The name of the package to install
# @param log_level
# Change log level, valid options DEBUG, INFO, WARNING, ERROR, CRITICAL.
# @param auto_config
# Attempt to auto configure with Satellite server.
# @param authmethod
# Change authentication method, valid options BASIC, CERT.
# @param username
# username to use when authmethod is BASIC.
# @param password
# password to use when authmethod is BASIC.
# @param base_url
# URL for your proxy. Example: http://user:[email protected]:8080
# @param proxy
# Proxy to use.
# @param cert_verify
# How to verify the certificate chain of api.access.redhat.com. Can be True,
# False or an absolute path.
# @param gpg
# Enable/Disable GPG verification of dynamic configuration.
# @param auto_update
# Automatically update the dynamic configuration.
# @param obfuscate
# Whether to obfuscate IP addresses.
# @param obfuscate_hostname
# Whether to obfuscate hostname.
# @param tags
# Data Hash to populate tags.yaml file
#
#
# @author Lindani Phiri <[email protected]>
# @author Dan Varga <[email protected]>
#
# Copyright 2015 Red Hat Inc.
#
class access_insights_client::current (
$package_name = 'insights-client',
Optional[Enum['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']] $log_level = undef,
$auto_config = 'True',
$authmethod = undef,
$username = undef,
$password = undef,
$base_url = undef,
$proxy = undef,
$cert_verify = undef,
$gpg = undef,
$auto_update = undef,
$obfuscate = undef,
$obfuscate_hostname = undef,
Hash $tags = {},
) {
package { $package_name:
ensure => installed,
}
# Ensure the old config is gone
file { [
'/etc/redhat-access-insights/redhat-access-insights.conf',
'/etc/cron.daily/redhat-access-insights',
'/etc/cron.weekly/redhat-access-insights',
]:
ensure => 'absent',
}
file { "/etc/${package_name}/${package_name}.conf":
ensure => 'file',
content => template('access_insights_client/redhat-access-insights.conf.erb'),
require => Package[$package_name],
}
if versioncmp($facts['os']['release']['full'], '7.0') >= 0 {
file { [
"/etc/cron.weekly/${package_name}",
"/etc/cron.daily/${package_name}",
]:
ensure => 'absent',
}
service { "${package_name}.timer":
ensure => 'running',
enable => true,
require => Package[$package_name],
}
} else {
file { "/etc/cron.daily/${package_name}":
ensure => 'link',
target => "/etc/${package_name}/${package_name}.cron",
require => Package[$package_name],
}
file { "/etc/cron.weekly/${package_name}":
ensure => 'absent',
}
}
file { "/etc/${package_name}/tags.yaml":
content => to_yaml($tags),
require => Package[$package_name],
}
exec { "/usr/bin/${package_name} --register":
creates => "/etc/${package_name}/.registered",
unless => "/usr/bin/test -f /etc/${package_name}/.unregistered",
require => Package[$package_name],
}
}