1# Taken from https://puppet.com/docs/puppet/5.5/lang_classes.html 2 3# /etc/puppetlabs/code/modules/webserver/manifests/params.pp 4 5class webserver::params { 6 $packages = $operatingsystem ? { 7 /(?i-mx:ubuntu|debian)/ => 'apache2', 8 /(?i-mx:centos|fedora|redhat)/ => 'httpd', 9 } 10 $vhost_dir = $operatingsystem ? { 11 /(?i-mx:ubuntu|debian)/ => '/etc/apache2/sites-enabled', 12 /(?i-mx:centos|fedora|redhat)/ => '/etc/httpd/conf.d', 13 } 14} 15 16# /etc/puppetlabs/code/modules/webserver/manifests/init.pp 17 18class webserver( 19 String $packages = $webserver::params::packages, 20 String $vhost_dir = $webserver::params::vhost_dir 21) inherits webserver::params { 22 23 package { $packages: ensure => present } 24 25 file { 'vhost_dir': 26 path => $vhost_dir, 27 ensure => directory, 28 mode => '0750', 29 owner => 'www-data', 30 group => 'root', 31 } 32} 33