Sha256: 993af4c6a74df40ed3679064e88361a7a0a4d5ce0700c6a412be2672e9f2c0f9

Contents?: true

Size: 1.97 KB

Versions: 20

Compression:

Stored size: 1.97 KB

Contents

#
# Author:: Joshua Timberman <joshua@opscode.com>
# Cookbook Name:: chef
# Recipe:: server_proxy
#
# Copyright 2009, Opscode, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

root_group = value_for_platform(
  "openbsd" => { "default" => "wheel" },
  "freebsd" => { "default" => "wheel" },
  "default" => "root"
)

node[:apache][:listen_ports] << "444" unless node[:apache][:listen_ports].include?("444")

include_recipe "chef::server"
include_recipe "apache2"
include_recipe "apache2::mod_ssl"
include_recipe "apache2::mod_proxy"
include_recipe "apache2::mod_proxy_http"
include_recipe "apache2::mod_proxy_balancer"
include_recipe "apache2::mod_rewrite"
include_recipe "apache2::mod_headers"

directory "/etc/chef/certificates" do
  owner "root"
  group root_group
  mode "700"
end

bash "Create SSL Certificates" do
  cwd "/etc/chef/certificates"
  code <<-EOH
  umask 077
  openssl genrsa 2048 > #{node[:chef][:server_fqdn]}.key
  openssl req -subj "#{node[:chef][:server_ssl_req]}" -new -x509 -nodes -sha1 -days 3650 -key #{node[:chef][:server_fqdn]}.key > #{node[:chef][:server_fqdn]}.crt
  cat #{node[:chef][:server_fqdn]}.key #{node[:chef][:server_fqdn]}.crt > #{node[:chef][:server_fqdn]}.pem
  EOH
  not_if { File.exists?("/etc/chef/certificates/#{node[:chef][:server_fqdn]}.pem") }
end

web_app "chef_server" do
  template "chef_server.conf.erb"
  server_name node[:chef][:server_fqdn]
  server_aliases [ node[:hostname], node[:fqdn], node[:chef][:server_fqdn] ]
  log_dir node[:apache][:log_dir]
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
poolparty-1.6.9 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.8 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.7 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.6 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.5 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.4 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.3 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.2 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.1 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.6.0 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.5.0 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.8 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.7 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.6 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.5 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.4 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.3 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.2 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.1 examples/chef_cloud/chef_repo/cookbooks/chef/recipes/server_proxy.rb
poolparty-1.4.0 examples/chef_cloud/chef-repo/cookbooks/chef/recipes/server_proxy.rb