Skip to content

Instantly share code, notes, and snippets.

@brenguy
Created November 17, 2017 17:47
Show Gist options
  • Save brenguy/cbaadd856a5329f08b557359ebd5e4a0 to your computer and use it in GitHub Desktop.
Save brenguy/cbaadd856a5329f08b557359ebd5e4a0 to your computer and use it in GitHub Desktop.
apache server recipe
#
# The package, named "httpd" is installed
#
# @see https://docs.chef.io/resource_package.html
#
package 'apache2'
#
# The template, named "/var/www/html/index.html" is created
# with the source "index.html.erb"
#
# @see https://docs.chef.io/resource_template.html
#
# The template file, named 'index.html.erb' can be found in the
# the templates folder under default. This means for all platforms:
#
# @see https://docs.chef.io/resource_template.html#file-specificity
#
template '/var/www/html/index.html' do
source 'index.html.erb'
end
template '/etc/apache2/ports.conf' do
source 'ports.conf.erb'
action :create
notifies :restart, 'service[apache2]'
end
#
# The service, named "apache2", is enabled and started.
#
# @see https://docs.chef.io/resource_service.html
#
service 'apache2' do
action [:enable, :start]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment