Skip to content

Instantly share code, notes, and snippets.

@JohnTheodore
Created October 7, 2014 03:19
Show Gist options
  • Save JohnTheodore/5a90edebaca5a71d11ee to your computer and use it in GitHub Desktop.
Save JohnTheodore/5a90edebaca5a71d11ee to your computer and use it in GitHub Desktop.
# Class: lmmclient
#
# This module manages lmmclient
class lmmclient (
$system_log = '', # override in heira/operatingsystem/<fill in dist>.yaml
$pkg_install_opts = [],
$package_name = 'lmmclient',
$package_ver = 'latest',
$lmm_ash2_broker = '',
$log_infra_apikey = '',
$log_infra_tenantid = '',
) {
realize Group[logstash]
realize User[logstash]
package { $package_name:
ensure => $package_ver,
install_options => $pkg_install_opts,
}
service { 'logstash':
ensure => running,
require => Package[$package_name],
}
# Since anyone can break logstash by dropping in files, we will rule /etc/logstash/conf.d with
# an iron fist. recurse => true means puppet actively deletes any files not managed by puppet
file { '/etc/logstash/conf.d':
ensure => directory,
recurse => true,
purge => true,
owner => 'logstash',
group => 'logstash',
mode => '0644',
require => [User['logstash'], Group['logstash'],],
}
$is_virtual = str2bool($::is_virtual)
$is_baremetal = ! $is_virtual
$is_kvm_vm = ($::manufacturer == 'Bochs' or $::manufacturer == 'OpenStack Foundation' and $is_virtual)
if $is_baremetal or $is_kvm_vm {
file { '10_log_infrastructure.conf':
ensure => 'file',
path => '/etc/logstash/conf.d/10_log_infrastructure.conf',
owner => 'logstash',
group => 'logstash',
mode => '0644',
content => template('lmmclient/10_log_infrastructure.conf.erb'),
before => Service['logstash']
}
}
}
class base::lmmclient_profile {
include base::params
if ( $base::params::debug == true ) {
notify{'DEBUG: Loading class base::lmmclient_profile': }
}
$is_virtual = str2bool($::is_virtual)
$is_baremetal = ! $is_virtual
$is_kvm_vm = ($::manufacturer == 'Bochs' or $::manufacturer == 'OpenStack Foundation' and $is_virtual)
# We will add kvaas, bpass, spass etc to this with an or conditional
if $is_baremetal or $is_kvm_vm {
class { 'lmmclient': }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment