Created
May 7, 2012 15:42
-
-
Save ottomata/2628514 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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