Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created June 28, 2011 23:12
Show Gist options
  • Save adamhjk/1052475 to your computer and use it in GitHub Desktop.
Save adamhjk/1052475 to your computer and use it in GitHub Desktop.
ports = node[:apache][:listen_ports].include?("443") ? node[:apache][:listen_ports] : [node[:apache][:listen_ports], "443"].flatten
ports_conf = nil
begin
ports_conf = resources(:template => "#{node[:apache][:dir]}/ports.conf")
ports_conf.ports(ports) unless ports_conf.ports.includes?("443")
rescue Chef::Exceptions::ResourceNotFound
template "#{node[:apache][:dir]}/ports.conf" do
source "ports.conf.erb"
variables :apache_listen_ports => ports
notifies :restart, resources(:service => "apache2")
mode 0644
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment