summaryrefslogtreecommitdiff
path: root/manifests/site/config.pp
blob: 8f4c1d45a4aa99f0d8070244efcaa45de4ed98e3 (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
60
61
62
63
64
65
66
67
68
69
define apache::site::config(
  $ensure               = 'present',
  $source               = false,
  $vhost                = $name,
  $docroot              = false,
  $redirect             = false,
  $redirect_match       = false,
  $protocol             = 'http',
  $aliases              = false,
  $server_alias         = false,
  $use                  = false,
  $template             = 'apache/site.erb',
  $mpm                  = true,
  $user                 = '',
  $gid                  = '',
  $ssl                  = false,
  $listen               = '*',
  $https_redirect       = false,
  $canonical            = false,
  $canonical_exceptions = '',
  $custom_log_format    = 'anon',
  $error_log            = false,
  $custom_log           = false,
  $custom_directives    = false,
  $allow_override       = false,
  $hosting_domain       = lookup('apache::site::domain', undef, undef, $::domain),
  $certbot              = false,
) {
  case $source {
    true: {
            file { "${apache::conf_sites}-available/$vhost.conf":
               ensure  => $ensure,
               source  => [ "puppet:///modules/site_apache/vhosts/${::domain}/${name}",
                            "puppet:///modules/site_apache/vhosts/${name}" ],
               owner   => root,
               group   => root,
               mode    => '0644',
               require => File["${apache::macros}"],
               notify  => Service["apache2"],
             }
           }
    false: {
             file { "${apache::conf_sites}-available/$vhost.conf":
               ensure  => $ensure,
               content => template("$template"),
               owner   => root,
               group   => root,
               mode    => '0644',
               require => File["${apache::macros}"],
               notify  => Service["apache2"],
             }
           }
  }

  # Enable the site without a2ensite
  #
  #$status = $ensure ? {
  #  'present' => "${apache::conf_sites}-available/$vhost.conf",
  #  default   => 'absent',
  #}
  #
  #file { "/etc/apache2/sites-enabled/$vhost.conf":
  #  ensure  => $status,
  #  owner   => root,
  #  group   => root,
  #  require => File["${apache::conf_sites}-available/${name}"],
  #  notify  => Service["apache2"],
  #}
}