Created
January 15, 2015 17:46
-
-
Save DBMoUK/bcf62ca3460a842315e5 to your computer and use it in GitHub Desktop.
vhost.pp
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 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