summaryrefslogtreecommitdiff
path: root/puppet/modules/site_static/manifests/init.pp
blob: ce79c00f440def308c93bd5f5c0ee77d7112b144 (plain)
1
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
class site_static {
  tag 'leap_service'

  include site_config::x509::cert
  include site_config::x509::key
  include site_config::x509::ca_bundle

  $static        = hiera('static')
  $domains       = $static['domains']
  $formats       = $static['formats']
  $bootstrap     = $static['bootstrap_files']

  if $bootstrap['enabled'] {
    $bootstrap_domain  = $bootstrap['domain']
    $bootstrap_client  = $bootstrap['client_version']
    file { '/srv/leap/provider.json':
      content => $bootstrap['provider_json'],
      owner   => 'www-data',
      group   => 'www-data',
      mode    => '0444';
    }
    # It is important to always touch provider.json: the client needs to check x-min-client-version header,
    # but this is only sent when the file has been modified (otherwise 304 is sent by apache). The problem
    # is that changing min client version won't alter the content of provider.json, so we must touch it.
    exec { '/bin/touch /srv/leap/provider.json':
      require => File['/srv/leap/provider.json'];
    }
  }

  class { '::apache': no_default_site => true, ssl => true }
  include site_apache::module::headers
  include site_apache::module::alias
  include site_apache::module::expires
  include site_apache::module::removeip
  include site_apache::module::rewrite

  if (member($formats, 'rack')) {
    include site_apt::preferences::passenger
    class { 'passenger':
      use_munin => false,
      require   => Class['site_apt::preferences::passenger']
    }
  }

  if (member($formats, 'amber')) {
    include site_config::ruby::dev
    rubygems::gem{'amber-0.3.4': }
  }

  create_resources(site_static::domain, $domains)

  include site_shorewall::defaults
  include site_shorewall::service::http
  include site_shorewall::service::https
}