Puppet Class: vnc::server::service

Inherits:
vnc::server
Defined in:
manifests/server/service.pp

Summary

Ensure the VNC Server services are right

Overview

Parameters:

  • manage_services (Any) (defaults to: $vnc::server::manage_services)

    Should this class manage the vncserver services

  • systemd_template_startswith (Any) (defaults to: $vnc::server::systemd_template_startswith)

    What does the vnc template service start with, not including the ‘@’

  • systemd_template_endswith (Any) (defaults to: $vnc::server::systemd_template_endswith)

    What does the vnc template service end with, not including the ‘.’

  • vnc_servers (Any) (defaults to: $vnc::server::vnc_servers)

    See the server.pp documentation for structure



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
45
46
47
48
49
50
# File 'manifests/server/service.pp', line 13

class vnc::server::service (
  # lint:ignore:parameter_types
  $manage_services         = $vnc::server::manage_services,

  $systemd_template_startswith = $vnc::server::systemd_template_startswith,
  $systemd_template_endswith   = $vnc::server::systemd_template_endswith,

  $vnc_servers = $vnc::server::vnc_servers
  # lint:endignore
) inherits vnc::server {
  assert_private()

  if $manage_services {
    $vnc_servers.keys.each |$username| {
      if 'ensure' in $vnc_servers[$username] {
        $ensure = $vnc_servers[$username]['ensure']
      } else {
        $ensure = 'running'
      }
      if 'enable' in $vnc_servers[$username] {
        $enable = $vnc_servers[$username]['enable']
      } else {
        $enable = true
      }

      unless 'displaynumber' in $vnc_servers[$username] {
        fail("You must set the 'displaynumber' property for ${username}'s vnc server")
      }

      # lint:ignore:140chars
      service { "${systemd_template_startswith}@:${vnc_servers[$username]['displaynumber']}.${systemd_template_endswith}":
        ensure => $ensure,
        enable => $enable,
      }
      # lint:endignore
    }
  }
}