Last active
August 29, 2015 14:01
-
-
Save johnfitzpatrick/38443f65a38578fdf77f to your computer and use it in GitHub Desktop.
Intermediate class cookbooks/apache/recipes/default.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
# | |
# Cookbook Name:: apache | |
# Recipe:: default | |
# | |
# Copyright 2014, YOUR_COMPANY_NAME | |
# | |
# All rights reserved - Do Not Redistribute | |
# | |
package "httpd" do | |
action :install | |
end | |
service "httpd" do | |
action [ :enable, :start ] | |
end | |
# Disable the default virtual host | |
execute "mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.disabled" do | |
only_if do | |
File.exist?("/etc/httpd/conf.d/welcome.conf") | |
end | |
notifies :restart, "service[httpd]" | |
end | |
# Iterate over the apache sites | |
search("apache_sites", "*:*").each do |site| | |
# Enable an Apache Virtualhost | |
apache_vhost site['id'] do | |
site_port site['port'] | |
action :create | |
notifies :restart, "service[httpd]" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment