Puppet Class: vnc::client::novnc::config

Inherits:
vnc::client::novnc
Defined in:
manifests/client/novnc/config.pp

Summary

Setup any token file or webserver index

Overview

Parameters:

  • manage_service_config (Any) (defaults to: $vnc::client::novnc::manage_service_config)

    should this clas manage any config files?

  • websockify_config_dir (Any) (defaults to: $vnc::client::novnc::websockify_config_dir)

    where are config files kept

  • websockify_config_mode (Any) (defaults to: $vnc::client::novnc::websockify_config_mode)

    where permissions should the configs have

  • websockify_token_plugin (Any) (defaults to: $vnc::client::novnc::websockify_token_plugin)

    what type of token plugin is in use

  • websockify_token_source (Any) (defaults to: $vnc::client::novnc::websockify_token_source)

    what is the data source for the token plugin if $websockify_token_plugin == ‘TokenFile’, this should be the filename

  • websockify_service_user (Any) (defaults to: $vnc::client::novnc::websockify_service_user)

    User to run the service as

  • websockify_service_group (Any) (defaults to: $vnc::client::novnc::websockify_service_group)

    Group to run the service as

  • make_webserver_vnc_index (Any) (defaults to: $vnc::client::novnc::make_webserver_vnc_index)

    Make a simple index file listing out known sessions

  • webserver_novnc_location (Any) (defaults to: $vnc::client::novnc::webserver_novnc_location)

    What is the URL base for novnc (probably /novnc)

  • webserver_vnc_index (Any) (defaults to: $vnc::client::novnc::webserver_vnc_index)

    Where should we write out the known session index?

  • vnc_servers (Any) (defaults to: $vnc::client::novnc::vnc_servers)

    What VNC servers should we connect to?



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'manifests/client/novnc/config.pp', line 29

class vnc::client::novnc::config (
  # lint:ignore:parameter_types
  $manage_service_config = $vnc::client::novnc::manage_service_config,
  $websockify_config_dir = $vnc::client::novnc::websockify_config_dir,
  $websockify_config_mode = $vnc::client::novnc::websockify_config_mode,
  $websockify_token_plugin = $vnc::client::novnc::websockify_token_plugin,
  $websockify_token_source = $vnc::client::novnc::websockify_token_source,
  $websockify_service_user = $vnc::client::novnc::websockify_service_user,
  $websockify_service_group = $vnc::client::novnc::websockify_service_group,

  $make_webserver_vnc_index = $vnc::client::novnc::make_webserver_vnc_index,
  $webserver_novnc_location = $vnc::client::novnc::webserver_novnc_location,
  $webserver_vnc_index = $vnc::client::novnc::webserver_vnc_index,

  $vnc_servers = $vnc::client::novnc::vnc_servers,
  # lint:endignore
) inherits vnc::client::novnc {
  assert_private()

  $vnc_sessions = Hash(flatten($vnc_servers.map |$key, $value| { [$key, { 'token' => stdlib::crc32("${key} ${value}"), 'connection' => $value }] }))   # lint:ignore:140chars

  if $manage_service_config {
    file { $websockify_config_dir:
      ensure => 'directory',
      owner  => 'root',
      group  => $websockify_service_group,
      mode   => $websockify_config_mode,
    }

    if $websockify_token_plugin == 'TokenFile' or $websockify_token_plugin == 'ReadOnlyTokenFile' {
      file { $websockify_token_source:
        ensure  => 'file',
        owner   => 'root',
        group   => $websockify_service_group,
        mode    => $websockify_config_mode,
        content => epp('vnc/etc/websockify/websockify-token.cfg.epp', { 'vnc_sessions' => $vnc_sessions }),
      }
    }
  }

  if $make_webserver_vnc_index {
    file { $webserver_vnc_index:
      ensure  => 'file',
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => epp('vnc/var/www/novnc_users_list.html.epp', { 'host' => "${trusted['hostname']}.${trusted['domain']}", 'vnc_sessions' => $vnc_sessions, 'novnc_location' => $webserver_novnc_location }),   # lint:ignore:140chars
    }
  }
}