Puppet Class: classroom_legacy::virtual

Inherits:
classroom_legacy::params
Defined in:
manifests/virtual.pp

Overview

common configuration for all virtual classes

Parameters:

  • control_repo (String)
  • event_id (Optional[Pattern[/\A(?:\w*-)+(\w*)\Z/]]) (defaults to: undef)
  • event_pw (Optional[String]) (defaults to: undef)
  • jvm_tuning_profile (Variant[Enum['reduced'], Boolean]) (defaults to: $classroom_legacy::params::jvm_tuning_profile)
  • offline (Boolean) (defaults to: $classroom_legacy::params::offline)
  • plugin_list (Array) (defaults to: $classroom_legacy::params::plugin_list)


2
3
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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'manifests/virtual.pp', line 2

class classroom_legacy::virtual (
  String                                  $control_repo,
  Optional[Pattern[/\A(?:\w*-)+(\w*)\Z/]] $event_id           = undef,
  Optional[String]                        $event_pw           = undef,
  Variant[Enum['reduced'], Boolean]       $jvm_tuning_profile = $classroom_legacy::params::jvm_tuning_profile,
  Boolean                                 $offline            = $classroom_legacy::params::offline,
  Array                                   $plugin_list        = $classroom_legacy::params::plugin_list,
) inherits classroom_legacy::params {
  assert_private('This class should not be called directly')

  if $classroom_legacy::params::role == 'master' {
    include showoff
    include classroom_legacy::master::dependencies::rubygems
    include classroom_legacy::master::dependencies::dashboard

    # Configure Hiera and install a Hiera data file to tune PE
    class { 'classroom_legacy::master::tuning':
      jvm_tuning_profile => $jvm_tuning_profile,
    }

    # make sure we have a deployment user
    include classroom_legacy::master::deployer

    # Configure performance logging
    include classroom_legacy::master::perf_logging

    # Set up gitea server
    include classroom_legacy::master::gitea

    $session_id = pick($event_pw, regsubst(String($event_id), '^(?:\w*-)+(\w*)$', '\1'), $classroom_legacy::params::session_id)

    class { 'puppetfactory':
      controlrepo      => $control_repo,
      plugins          => $plugin_list,
      gitserver        => $classroom_legacy::params::gitserver,
      repomodel        => $classroom_legacy::params::repo_model,
      usersuffix       => $classroom_legacy::params::usersuffix,
      dashboard_path   => "${showoff::root}/courseware/_files/tests",
      session          => $session_id,
      master           => $fqdn,
      privileged       => false,
    }

    class { 'classroom_legacy::master::codemanager':
      control_repo => $control_repo,
    }

  } elsif $classroom_legacy::params::role == 'proxy' {
    include classroom_legacy::proxy

  } else {
    # ensure all nodes have this user, since it's used for file ownership in places
    user { 'pe-puppet':
      ensure => present,
    }

    # if we ever have universal classification for virtual agents, it will go here
    include classroom_legacy::agent::hiera
    include classroom_legacy::agent::packages
    include classroom_legacy::agent::rubygems

    unless $osfamily == 'windows' {
      include classroom_legacy::agent::postfix_ipv4

      # enable the local yum cache configured by puppetfactory
      yumrepo { 'local':
        ensure   => 'present',
        baseurl  => 'file:///var/yum/mirror',
        enabled  => '1',
        gpgcheck => '0',
        priority => '1',
      }

    }
  }

  # configure gem installs
  class { 'classroom_legacy::gemrc':
    offline => $offline,
  }

  if $::osfamily == 'windows' {
    # TODO: copied from classroom_legacy::windows; we should refactor both classes for reusability
    user { 'Administrator':
      ensure => present,
      groups => ['Administrators'],
    }

    chocolateyfeature { 'allowEmptyChecksums':
      ensure => enabled,
    }
    Chocolateyfeature['allowEmptyChecksums'] -> Package<| provider == 'chocolatey' |>

    # Windows Agents
    class {'chocolatey':
      chocolatey_download_url => 'https://chocolatey.org/api/v2/package/chocolatey/0.10.3',
    }

    include classroom_legacy::windows::disable_esc
    include classroom_legacy::windows::enable_rdp
    include classroom_legacy::windows::geotrust
    windows_env { 'PATH=C:\Program Files\Puppet Labs\Puppet\sys\ruby\bin': }
  }

  # fix augeas lens until it's updated in PE
  include classroom_legacy::agent::augeas
}