Puppet Class: wsusserver::install

Inherits:
wsusserver::params
Defined in:
manifests/install.pp

Overview

Class: wsusserver::install

Parameters:

  • package_ensure (Enum['present', 'absent']) (defaults to: $wsusserver::params::package_ensure)
  • include_management_console (Boolean) (defaults to: $wsusserver::params::include_management_console)
  • wsus_directory (Stdlib::Absolutepath) (defaults to: $wsusserver::params::wsus_directory)
  • join_improvement_program (Boolean) (defaults to: $wsusserver::params::join_improvement_program)


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

class wsusserver::install(
  Enum['present', 'absent'] $package_ensure        = $wsusserver::params::package_ensure,
  Boolean $include_management_console              = $wsusserver::params::include_management_console,
  Stdlib::Absolutepath $wsus_directory             = $wsusserver::params::wsus_directory,
  Boolean $join_improvement_program                = $wsusserver::params::join_improvement_program,
) inherits wsusserver::params {

  windowsfeature { 'UpdateServices':
    ensure => $package_ensure,
    notify => Exec["post install wsus content directory ${wsus_directory}"],
  }

  $_management_console_ensure = $include_management_console ? {
    true    => 'present',
    default => 'absent',
  }
  windowsfeature { 'UpdateServices-UI':
    ensure  => $_management_console_ensure,
    require => Windowsfeature['UpdateServices'],
  }

  $join_improvement_program_flag = bool2num($join_improvement_program)
  exec { "post install wsus content directory ${wsus_directory}":
    command     => "if (!(Test-Path -Path \$env:TMP)) {
                      New-Item -Path \$env:TMP -ItemType Directory
                    }
                    & 'C:\\Program Files\\Update Services\\Tools\\WsusUtil.exe' PostInstall CONTENT_DIR=\"${wsus_directory}\" MU_ROLLUP=${join_improvement_program_flag}
                    if (\$LASTEXITCODE -eq 1) { 
                      Exit 1 
                    } 
                    else { 
                      Exit 0 
                    }",
    logoutput   => true,
    refreshonly => true,
    timeout     => 1200,
    provider    => 'powershell',
    require     => [Windowsfeature['UpdateServices'], Windowsfeature['UpdateServices-UI']]
  }
}