Skip to content

Instantly share code, notes, and snippets.

@DBMoUK
Created January 15, 2015 17:46
Show Gist options
  • Save DBMoUK/bcf62ca3460a842315e5 to your computer and use it in GitHub Desktop.
Save DBMoUK/bcf62ca3460a842315e5 to your computer and use it in GitHub Desktop.
vhost.pp
define apache::vhost (
$port = '80',
$priority = '10',
$options = 'Indexes MultiViews',
$vhost_name = $title,
$servername = $title,
$docroot = "${apache::httpd_docroot}/${title}",
){
$docowner = $apache::httpd_user
$docgroup = $apache::httpd_group
$confdir = $apache::httpd_conf_dot_d
host { $servername:
ip => $::ipaddress,
}
File {
owner => $docowner,
group => $docgroup,
mode => '0644',
}
file { "vhost-${title}":
ensure => file,
path => "${confdir}/${priority}-${title}.conf",
notify => Service[$apache::httpd_svc],
content => template('apache/vhost.conf.erb'),
require => Package[$apache::httpd_pkg],
}
file { $docroot:
ensure => directory,
before => File["vhost-${title}"],
}
file { "${docroot}/index.html":
ensure => file,
content => template("apache/index.html.erb"),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment