Puppet Class: voipmonitor::sniffer::install

Defined in:
manifests/sniffer/install.pp

Overview

Installs voipmon sniffer from official binaries

Parameters:

  • base_url (String)
  • install_location (String)
  • spooldir_prefix (String)


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
# File 'manifests/sniffer/install.pp', line 2

class voipmonitor::sniffer::install (
  String $base_url,
  String $install_location,
  String $spooldir_prefix,
){
  # Step 0: make sure install location exists
  file { $install_location:
    ensure => directory
  }

  # Step 1: get binaries
  case $facts['os']['architecture'] {
    'amd64': { $arch = '64bit' }
    default:  { $arch = '32bit' }
  }
  $filename = "current-stable-sniffer-static-${arch}.tar.gz"
  exec { 'get binary':
    command => "/usr/bin/wget http://${base_url}/${filename} -O ${install_location}/${filename}",
    creates => "${install_location}/install-script.sh"
  }
  -> exec { 'unpack':
    command => "/bin/tar -xf ${filename} --strip 1",
    creates => "${install_location}/install-script.sh",
    cwd     => $install_location
  }
  -> exec { 'delete old file':
    command => "/bin/rm ${install_location}/${filename}",
    onlyif  => "/usr/bin/test -f ${install_location}/${filename}",
  }

  # Step 2: trigger install
  exec { 'install script':
    command => "/bin/bash ${install_location}/install-script.sh && touch ${install_location}/.installed",
    creates => "${install_location}/.installed",
    cwd     => $install_location
  }

  # Step 3: make sure spooldir exists
  file { $spooldir_prefix:
    ensure => directory,
    owner  => 'www-data'
  }
}