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
|
# File 'manifests/ondemand.pp', line 24
class xdmod::ondemand (
Optional[String] $geoip_userid = undef,
Optional[String] $geoip_licensekey = undef,
String $version = $xdmod::params::xdmod_ondemand_version,
String $package_name = 'xdmod-ondemand',
String $package_ensure = 'installed',
Stdlib::HTTPSUrl $package_url = $xdmod::params::ondemand_package_url,
String $log_format = '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"',
Array[Integer, 2, 2] $cron_times = [0,7],
Boolean $manage_cron = true,
) inherits xdmod::params {
include xdmod
if $geoip_userid and $geoip_licensekey {
$geoip_directory = '/usr/share/GeoIP'
$geoip_database = "${geoip_directory}/GeoLite2-City.mmdb"
$update_timer_hour = sprintf('%02d', ($cron_times[1] - 1))
class { 'geoip':
config => {
'userid' => $geoip_userid,
'licensekey' => $geoip_licensekey,
'database_directory' => $geoip_directory,
'productids' => ['GeoLite2-City'],
},
update_timers => [
"*-*-* ${update_timer_hour}:00:00",
],
}
File <| title == $geoip::config_path |> {
show_diff => false,
}
} else {
$geoip_database = ''
}
if $xdmod::local_repo_name {
package { 'xdmod-ondemand':
ensure => $package_ensure,
name => $package_name,
require => $xdmod::_package_require,
before => File['/etc/xdmod/portal_settings.d/ondemand.ini'],
}
$package_resource = Package['xdmod-ondemand']
} else {
$_package_url = regsubst($package_url, 'VERSION', $version, 'G')
yum::install { $package_name:
ensure => 'present',
source => $_package_url,
require => $xdmod::_package_require,
before => File['/etc/xdmod/portal_settings.d/ondemand.ini'],
}
$package_resource = Yum::Install[$package_name]
}
file { '/etc/xdmod/portal_settings.d/ondemand.ini':
ensure => 'file',
owner => 'apache',
group => 'xdmod',
mode => '0440',
}
xdmod_ondemand_setting { 'ondemand-general/geoip_database': value => $geoip_database }
xdmod_ondemand_setting { 'ondemand-general/webserver_format_str': value => $log_format }
file { '/usr/local/bin/xdmod-ondemand-ingest.sh':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0755',
content => template('xdmod/ondemand/ingest.sh.erb'),
before => File['/etc/cron.d/xdmod-ondemand'],
}
if $manage_cron {
file { '/etc/cron.d/xdmod-ondemand':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
content => template('xdmod/ondemand/cron.erb'),
}
}
}
|