Forked from johnfitzpatrick/cookbooks_apache_providers_vhost.rb
Created
October 6, 2015 19:49
-
-
Save scarolan/ba973165e67f107427ea to your computer and use it in GitHub Desktop.
cookbooks/apache/providers/vhost.rb
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
use_inline_resources | |
action :create do | |
# Set the document root | |
document_root = "/srv/apache/#{new_resource.site_name}" | |
# Add a template for Apache virtual host configuration | |
template "/etc/httpd/conf.d/#{new_resource.site_name}.conf" do | |
source "custom.erb" | |
mode "0644" | |
variables( | |
:document_root => document_root, | |
:port => new_resource.site_port | |
) | |
end | |
directory document_root do | |
mode "0755" | |
recursive true | |
end | |
# Add a template resource for the virtual host's index.html | |
template "#{document_root}/index.html" do | |
source "index.html.erb" | |
mode "0644" | |
variables( | |
:site_name => new_resource.site_name, | |
:port => new_resource.site_port | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment