Puppet Class: uhosting

Defined in:
manifests/init.pp

Overview

Class: uhosting

This is the main class of uhosting. It is used to generate sites and includes the needed classes.

Parameters

sites

Hash of sites. See README for details.

redirects

Hash of redirects. See README for details.

dns_zones

Hash of DNS zones. See README for details.

certificates

Hash of certificate data. See README for details.

Authors

Tobias Brunner <tobias.brunner@vshn.ch>

Copyright 2015 Tobias Brunner, VSHN AG

Parameters:

  • sites (Any)
  • redirects (Any) (defaults to: undef)
  • dns_zones (Any) (defaults to: undef)
  • certificates (Any) (defaults to: undef)
  • sshlogin_group (Any) (defaults to: 'sshlogin')


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
70
71
72
73
74
75
# File 'manifests/init.pp', line 28

class uhosting (
  $sites,
  $redirects = undef,
  $dns_zones = undef,
  $certificates = undef,
  $sshlogin_group = 'sshlogin',
) {

  ## Validate mandatory parameters

  validate_hash($sites)

  ## Manage DNS if there are DNS zone defined

  if $dns_zones {
    validate_hash($dns_zones)
    include uhosting::profiles::knot
  }

  ## Create SSL certificate and key files if there are any defined

  if $certificates {
    validate_hash($certificates)
    $cert_names = keys($certificates)
    ensure_packages('ssl-cert')
    ::uhosting::resources::certificates { $cert_names:
      data    => $certificates,
      require => Package['ssl-cert'],
    }
  }

  ## Create Sites

  $site_names = keys($sites)
  ::uhosting::resources::site { $site_names:
    data => $sites,
  }

  ## System preparation
  # create directory for the uwsgi/fpm sockets
  file { '/var/lib/uhosting':
    ensure => directory,
    owner  => 'www-data',
    group  => 'www-data',
    mode   => '0775',
  }

}