# Creates a std vhost, # # * the name of the apache::vhost{...} resource will be the primary ServerName of the vhost # * $aliases can be an array of aliases # * prefix defaults to /srv/www/, overide it with $prefix to create $prefix/html and $prefix/logs, # if you want to make a prefix other than /srv/www be sure to create a file{} resource for it first # as there are dependencies on a File["${prefix}"] # * $customlines is an array of lines to insert into the vhost, they'll go in the order of the array # * ensure => absent will remove the vhost, but not he data # * setting $allowoverride will create an AllowOverride on the webroot with what u put in the var # * setting $options will create an Options on the webroot with what u put in the var # * The default template is a minimal vhost, you can specify any template you like in $template define apache::vhost($aliases = "NONE", $prefix = "/srv/www", $customlines = "", $ensure = "present", $template = "apache/default-vhost.erb", $allowoverride = "", $options = "") { $mainvhost = $name case $aliases { "NONE": { $aliasnames = "" } default: { $aliasnames = $aliases } } $docroot = "${prefix}/${mainvhost}/html" $logdir = "${prefix}/${mainvhost}/logs" file{"${prefix}/${mainvhost}": owner => root, group => root, mode => 755, ensure => directory, require => File["${prefix}"] } file{["${prefix}/${mainvhost}/html", "${prefix}/${mainvhost}/logs"]: owner => root, group => root, mode => 755, ensure => directory, require => File["${prefix}/${mainvhost}"] } file{"/etc/httpd/conf.d/$mainvhost.conf": owner => root, group => root, mode => 644, ensure => $ensure, content => template($template), notify => Service["httpd"], require => Package["httpd"] } }