Create a new subclass to build the dl_url and pkg_name to get Xymon
server package. xymon::server::install: download the Xymon server package
This commit is contained in:
parent
e3b4ede749
commit
9896558d73
@ -40,7 +40,10 @@ class xymon::params {
|
||||
## Server
|
||||
# Package
|
||||
$srv_dep_pkg_name = [ 'debconf', 'libc-ares2', 'libc6', 'libldap-2.4-2', 'libpng12-0', 'librrd4', 'libssl1.0.0', 'perl' ]
|
||||
$srv_package_name = 'xymon'
|
||||
$srv_download_dir = '/opt/xymon/packages'
|
||||
$srv_download_url = undef
|
||||
$srv_new_version = '4.3.17'
|
||||
$srv_package_name = undef
|
||||
|
||||
}
|
||||
default: {
|
||||
|
@ -23,6 +23,9 @@
|
||||
#
|
||||
class xymon::server (
|
||||
$dep_pkg_name = $xymon::params::srv_dep_pkg_name,
|
||||
$download_dir = $xymon::params::srv_download_dir,
|
||||
$download_url = $xymon::params::srv_download_url,
|
||||
$new_version = $xymon::params::srv_new_version,
|
||||
$package_name = $xymon::params::srv_package_name,
|
||||
) inherits xymon::params {
|
||||
|
||||
@ -32,11 +35,13 @@ class xymon::server (
|
||||
}
|
||||
}
|
||||
|
||||
include '::xymon::server::preconfig'
|
||||
include '::xymon::server::install'
|
||||
#include '::xymon::server::config'
|
||||
#include '::xymon::server::service'
|
||||
|
||||
#Class['::xymon::server::install'] ->
|
||||
Class['::xymon::server::preconfig'] ->
|
||||
Class['::xymon::server::install']
|
||||
#Class['::xymon::server::config'] ->
|
||||
#Class['::xymon::server::service']
|
||||
|
||||
|
@ -4,15 +4,28 @@
|
||||
#
|
||||
class xymon::server::install {
|
||||
|
||||
Exec {
|
||||
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ],
|
||||
logoutput => 'on_failure',
|
||||
}
|
||||
|
||||
|
||||
## Packages
|
||||
# Install dependencies¬
|
||||
ensure_resource('package', $xymon::server::dep_pkg_name , {'ensure' => 'present'})
|
||||
|
||||
# Install Xymon server package
|
||||
package { $xymon::server::package_name:
|
||||
ensure => present,
|
||||
require => [ Package[$xymon::server::dep_pkg_name], Class['::xymon::client'] ],
|
||||
# Download the latest Xymon server package
|
||||
exec { 'Download Xymon Server':
|
||||
command => "wget ${xymon::server::preconfig::dl_url}/${xymon::server::preconfig::pkg_name} -O ${xymon::server::preconfig::pkg_name}",
|
||||
cwd => $xymon::server::download_dir,
|
||||
creates => "${xymon::server::download_dir}/${xymon::server::preconfig::pkg_name}",
|
||||
}
|
||||
#->
|
||||
# Install Xymon server package
|
||||
#package { $xymon::server::package_name:
|
||||
#ensure => present,
|
||||
#require => [ Package[$xymon::server::dep_pkg_name], Class['::xymon::server'] ],
|
||||
#}
|
||||
|
||||
|
||||
} # Private class: xymon::server::install
|
||||
|
45
manifests/server/preconfig.pp
Normal file
45
manifests/server/preconfig.pp
Normal file
@ -0,0 +1,45 @@
|
||||
# == Class: xymon::server::preconfig
|
||||
#
|
||||
# Some configurations before install Xymon server
|
||||
#
|
||||
class xymon::server::preconfig {
|
||||
|
||||
# Define the download URL
|
||||
if $xymon::server::download_url == undef {
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
# From Xymon project via Sourceforge
|
||||
$dl_url = "http://ufpr.dl.sourceforge.net/project/xymon/Xymon/${xymon::server::new_version}"
|
||||
}
|
||||
default: {
|
||||
fail('Please define a download_url.')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$dl_url = $xymon::server::download_url
|
||||
}
|
||||
|
||||
# Define the package name
|
||||
if $xymon::server::package_name == undef {
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
$pkg_name = "xymon_${xymon::server::new_version}_${::architecture}.deb"
|
||||
}
|
||||
default: {
|
||||
fail('Please define a package_name.')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pkg_name = $xymon::server::package_name
|
||||
}
|
||||
#http://ufpr.dl.sourceforge.net/project/xymon/Xymon/4.3.17/xymon_4.3.17_amd64.deb
|
||||
|
||||
exec { 'Create download directory for Xymon server package':
|
||||
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ],
|
||||
command => "mkdir -p -- ${xymon::server::download_dir}",
|
||||
creates => $xymon::server::download_dir,
|
||||
logoutput => 'on_failure',
|
||||
}
|
||||
|
||||
|
||||
} # Private class: xymon::server::preconfig
|
Loading…
Reference in New Issue
Block a user