Puppet Class: mrepo::webservice

Defined in:
manifests/webservice.pp

Overview

This class installs and configures apache to serve mrepo repositories.

Examples

This class does not need to be directly included

Author

Adrien Thebo <adrien@puppetlabs.com>

Copyright 2011 Puppet Labs, unless otherwise noted

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')


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
# File 'manifests/webservice.pp', line 15

class mrepo::webservice (
  Enum['present', 'absent'] $ensure = 'present'
) {
  include mrepo

  $user       = $mrepo::user
  $group      = $mrepo::group
  $docroot    = $mrepo::www_root
  $servername = $mrepo::www_servername
  $priority   = $mrepo::priority
  $port       = $mrepo::port
  $ip_based   = $mrepo::www_ip_based
  $ip         = $mrepo::www_ip

  case $ensure {
    'present': {
      include apache

      file { $docroot:
        ensure => directory,
        owner  => $user,
        group  => $group,
        mode   => '0755',
      }

      apache::vhost { 'mrepo':
        priority        => $priority,
        port            => $port,
        servername      => $servername,
        docroot         => $docroot,
        custom_fragment => template("${module_name}/apache.conf.erb"),
        ip_based        => $ip_based,
      }
      if $ip_based {
        Apache::Vhost['mrepo'] {
          ip => $ip,
        }
      }
    }
    default: {
      apache::vhost { 'mrepo':
        ensure  => $ensure,
        port    => $port,
        docroot => $docroot,
      }
    }
  }
}