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:: myapache | |
# Recipe:: default | |
# | |
# Copyright (c) 2014 The Authors, All Rights Reserved. | |
# | |
package "httpd" | |
execute "mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.disabled" do | |
only_if do |
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
ServerTokens OS | |
ServerRoot "/etc/httpd" | |
PidFile run/httpd.pid | |
Timeout 60 | |
KeepAlive Off | |
MaxKeepAliveRequests 100 | |
KeepAliveTimeout 15 | |
<IfModule prefork.c> | |
StartServers 8 |
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
node.default['haproxy']['members'] = [{ | |
"hostname" => "localhost", | |
"ipaddress" => "127.0.0.1", | |
"port" => node["myapache"]["port"], | |
"ssl_port" => node["myapache"]["port"] | |
}] | |
node.default['haproxy']['admin']['address_bind'] = "0.0.0.0" | |
node.default['haproxy']['admin']['port'] = 8082 | |
node.default['haproxy']['enable_stats_socket'] = true |
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 2013, YOUR_COMPANY_NAME | |
# | |
# All rights reserved - Do Not Redistribute | |
# | |
package "httpd" do |
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
require 'spec_helper' | |
describe 'mailx::default' do | |
context 'on Debian' do | |
let(:chef_run) { ChefSpec::Runner.new({:platform => 'ubuntu', :version => '14.04'}).converge(described_recipe) } | |
it 'should install the correct packages' do | |
expect(chef_run).to install_package 'mailutils' | |
end | |
end |
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 |
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" |
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
require 'rubygems' | |
require 'pony' | |
module MyCompany | |
class EmailMe < Chef::Handler | |
def initialize(from_address, to_address) | |
@from_address = from_address | |
@to_address = to_address | |
end |
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
chef_gem "pony" do | |
action :install | |
end | |
include_recipe "chef_handler" | |
cookbook_file "#{node['chef_handler']['handler_path']}/email_handler.rb" do | |
source "handlers/email_handler.rb" | |
owner "root" | |
group "root" |
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
Ohai.plugin(:Apache) do | |
provides "apache/modules" | |
collect_data(:default) do | |
apache Mash.new | |
apache[:modules] = {:static => [], :shared => []} | |
modules = shell_out("apachectl -t -D DUMP_MODULES") | |
modules.stdout.each_line do |line| | |
fullkey, value = line.split(/\(/, 2).map {|i| i.strip} | |
apache_mod = fullkey.gsub(/_module/,"") |