summaryrefslogtreecommitdiff
path: root/puppet/modules/site_static/manifests/domain.pp
blob: e456c94e9c094f57875659387bf61ab8f88a58dc (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
# configure static service for domain
define site_static::domain (
  $ca_cert=undef,
  $key,
  $cert,
  $tls_only=true,
  $use_hidden_service=false,
  $locations=undef,
  $aliases=undef,
  $apache_config=undef,
  $www_alias=false) {

  $domain = $name
  $base_dir = '/srv/static'

  if ($ca_cert) {
    $certfile = "${cert}\n${ca_cert}"
  } else {
    $certfile = $cert
  }

  if is_hash($locations) {
    create_resources(site_static::location, $locations)
  }

  x509::cert { $domain:
    content => $certfile,
    notify  => Service[apache]
  }
  x509::key { $domain:
    content => $key,
    notify  => Service[apache]
  }

  apache::vhost::file { $domain:
    content => template('site_static/apache.conf.erb')
  }

}