Debian Codegraph @

demo/kitchen-sink/docs/puppet.epp

raw
1 define apache::vhost ($port, $docroot, $servername = $title, $vhost_name = '*') {
2 include apache
3 include apache::params
4 $vhost_dir = $apache::params::vhost_dir
5 file { "${vhost_dir}/${servername}.conf":
6 content => template('apache/vhost-default.conf.erb'),
7 owner => 'www',
8 group => 'www',
9 mode => '644',
10 require => Package['httpd'],
11 notify => Service['httpd'],
12 }
13 }
14
15 type MyModule::Tree = Array[Variant[Data, Tree]]
16
17 function apache::bool2http(Variant[String, Boolean] $arg) >> String {
18 case $arg {
19 false, undef, /(?i:false)/ : { 'Off' }
20 true, /(?i:true)/ : { 'On' }
21 default : { "$arg" }
22 }
23 }
24
25 # A class with parameters
26 class apache (String $version = 'latest') {
27 package {'httpd':
28 ensure => $version, # Using the class parameter from above
29 before => File['/etc/httpd.conf'],
30 }
31 file {'/etc/httpd.conf':
32 ensure => file,
33 owner => 'httpd',
34 content => template('apache/httpd.conf.erb'), # Template from a module
35 }
36 service {'httpd':
37 ensure => running,
38 enable => true,
39 subscribe => File['/etc/httpd.conf'],
40 }
41 }
42
43
44 if $is_virtual {
45 warning( 'Tried to include class ntp on virtual machine; this node might be misclassified.' )
46 }
47 elsif $operatingsystem == 'Darwin' {
48 warning( 'This NTP module does not yet work on our Mac laptops.' )
49 else {
50 include ntp
51 }