summaryrefslogtreecommitdiff
path: root/puppet/modules/site_webapp/manifests/apache.pp
blob: d604b00fa4b7e73a64f9fc6f638b18fcd01ce6aa (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
56
57
58
59
class site_webapp::apache {

  $web_api          = hiera('api')
  $api_domain       = $web_api['domain']
  $api_port         = $web_api['port']

  $web_domain       = hiera('domain')
  $domain_name      = $web_domain['name']

  $x509             = hiera('x509')
  $commercial_key   = $x509['commercial_key']
  $commercial_cert  = $x509['commercial_cert']
  $commercial_root  = $x509['commercial_ca_cert']

  include site_config::x509::cert_key
  include site_config::x509::ca

  include x509::variables

  X509::Cert[$site_config::params::cert_name] ~> Service[apache]
  X509::Key[$site_config::params::cert_name]  ~> Service[apache]
  X509::Ca[$site_config::params::ca_name]  ~> Service[apache]

  class { '::apache': no_default_site => true, ssl => true }

  include site_apache::module::headers
  include site_apache::module::rewrite
  include site_apache::module::alias

  class { 'passenger': use_munin => false }

  apache::vhost::file {
    'leap_webapp':
      content => template('site_apache/vhosts.d/leap_webapp.conf.erb')
  }

  apache::vhost::file {
    'api':
      content => template('site_apache/vhosts.d/api.conf.erb')
  }

  x509::key {
    'leap_webapp':
      content => $commercial_key,
      notify  => Service[apache];
  }

  x509::cert {
    'leap_webapp':
      content => $commercial_cert,
      notify  => Service[apache];
  }

  x509::ca {
    'leap_webapp':
      content => $commercial_root,
      notify  => Service[apache];
  }
}