Skip to content

Instantly share code, notes, and snippets.

@ottomata
Created May 7, 2012 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ottomata/2628514 to your computer and use it in GitHub Desktop.
Save ottomata/2628514 to your computer and use it in GitHub Desktop.
define virtual_host(
$enabled = true,
$ip_address = "*",
$port = "80",
$document_root,
$server_name,
$server_alias = false,
$server_admin = false,
$htpasswd = false,
$xcache = false,
$cs_environment = false,
$httpdlabel = "httpd",
$allow_override = true,
$require_lb_ssl = false)
{
file { "/etc/$httpdlabel/sites/$name":
mode => 0644,
owner => "root",
group => "root",
content => template("webserver/virtual_host.erb"),
require => Package["httpd"],
ensure => $enabled ? {
true => "file",
false => "absent",
},
}
# reload apache if the virtual host file changes
exec { "httpd_reload_$httpdlabel_$name":
command => "/etc/init.d/$httpdlabel reload",
subscribe => File["/etc/$httpdlabel/sites/$name"],
refreshonly => true,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment