Puppet Class: classroom_legacy::master::student_environment

Defined in:
manifests/master/student_environment.pp

Overview

This is a temporary hack to make sure that student masters have a production environment created. We will revisit this post PE3.7 release



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

class classroom_legacy::master::student_environment {
  assert_private('This class should not be called directly')

  $environmentpath = "${classroom_legacy::codedir}/environments"
  $environmentname = 'production'
  $environment     = "${environmentpath}/${environmentname}"

  File {
    owner   => 'pe-puppet',
    group   => 'pe-puppet',
    mode    => '0644',
    require => Dirtree['environment path'],
  }

  # We cannot assume this directory exists, but we need to put files in it.
  dirtree { 'environment path':
    ensure  => present,
    path    => $environmentpath,
    parents => true,
  }

  file { [
    $environment,
    "${environment}/manifests",
    "${environment}/modules",
  ]:
    ensure => directory,
  }

  # We only want to write this once so it isn't confusing later on.
  unless ($::puppetlabs_class) {
    # This is a copy of site.pp used for the architect class
    file { "${environment}/manifests/site.pp":
      ensure  => file,
      source  => 'puppet:///modules/classroom_legacy/site-architect.pp',
      replace => false,
    }

    # intentionally broken example code
    file { "${environment}/modules/cowsay":
      ensure  => directory,
      source  => 'puppet:///modules/classroom_legacy/example/cowsay',
      replace => false,
      recurse => true,
    }
  }

}