Puppet Class: windows::nssm

Defined in:
manifests/nssm.pp

Overview

Class: windows::nssm

Installs NSSM: the Non-Sucking Service Manager.

Parameters

version

The version of NSSM to install, defaults to ‘2.24’.

base_url

The base URL to download the NSSM ZIP file from, defaults to: ‘nssm.cc/download/’. Must have a trailing slash.

destination

The root folder where the NSSM ZIP file is extracted to, defaults to ‘C:Program Files’.

Parameters:

  • version (Any) (defaults to: '2.24')
  • base_url (Any) (defaults to: 'http://nssm.cc/download/')
  • destination (Any) (defaults to: 'C:\Program Files')


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
# File 'manifests/nssm.pp', line 18

class windows::nssm(
  $version     = '2.24',
  $base_url    = 'http://nssm.cc/download/',
  $destination = 'C:\Program Files'
) {
  include windows
  $basename = "nssm-${version}.zip"
  $nssm_url = "${base_url}${basename}"
  $nssm_zip = "${windows::installers}\\${basename}"

  # The root location of NSSM.
  $root = "${destination}\\nssm-${version}"

  # Setting the path depending on the system architecture.
  if $::architecture == 'x64' {
    $path = "${root}\\win64"
  } else {
    $path = "${root}\\win32"
  }

  # Download the NSSM zip archive.
  sys::fetch { 'download-nssm':
    source      => $nssm_url,
    destination => $nssm_zip,
    require     => File[$windows::installers],
  }

  # Unzip the NSSM archive into the destination, creating the root folder.
  windows::unzip { $nssm_zip:
    destination => $destination,
    creates     => $root,
    require     => Sys::Fetch['download-nssm'],
  }
}