Puppet Class: consul::windows_service

Defined in:
manifests/windows_service.pp

Summary

Installs consul windows server

Overview

Parameters:

  • sys32 (Stdlib::Windowspath) (defaults to: 'c:\\windows\\system32')

    path to system32 folder

  • service_name (String[1]) (defaults to: 'Consul')

    Name of the service



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'manifests/windows_service.pp', line 9

class consul::windows_service (
  Stdlib::Windowspath $sys32 = 'c:\\windows\\system32',
  String[1] $service_name = 'Consul'
) {
  assert_private()
  $executable_file = "${consul::bin_dir}\\${consul::binary_name}"
  $service_config = "start= auto binPath= \"${executable_file} agent -config-dir=${$consul::config_dir}\" obj= \"${consul::binary_owner}\""

  exec { 'create_consul_service':
    command => "sc.exe create ${service_name} ${service_config}",
    path    => $sys32,
    unless  => "sc.exe query ${service_name}",
  }
  exec { 'update_consul_service':
    command     => "sc.exe config ${service_name} ${service_config}",
    path        => $sys32,
    refreshonly => true,
  }
}