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
| <html> | |
| <body> | |
| <h1>Welcome to <%= node["motd"]["company"] %></h1> | |
| <h2>We love <%= @site_name %></h2> | |
| <%= node["ipaddress"] %>:<%= @port %> | |
| </body> | |
| </html> |
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
| <% if @port != 80 -%> | |
| Listen <%= @port %> | |
| <% end -%> | |
| <VirtualHost *:<%= @port %>> | |
| ServerAdmin webmaster@localhost | |
| DocumentRoot <%= @document_root %> | |
| <Directory /> | |
| Options FollowSymLinks |
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
| powershell_script "Install IIS" do | |
| code "add-windowsfeature Web-Server" | |
| action :run | |
| end | |
| service "w3svc" do | |
| action [:enable, :start ] | |
| end | |
| #node.default["iis_demo"]["indexfile"] = "Default2.htm" |
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
| <html> | |
| <body> | |
| <h1>Hello, <%= node['iis_demo']['greeting'] %>!</h1> | |
| <h2>This is server <%= node['hostname']%></h2> | |
| <h3>Do you know the capitals of the following countries?</h3> | |
| <% @country.each do |item| -%> | |
| <p><a href=<%="#{item}"%>.htm><%="#{item}"%></a></p> | |
| <% end -%> | |
| </body> | |
| </html> |
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:: iis_demo | |
| # Recipe:: default | |
| # | |
| # Copyright 2014, Chef Workshops, Inc. | |
| # | |
| # All rights reserved - Do Not Redistribute | |
| # | |
| powershell_script "Install IIS" do | |
| code "add-windowsfeature Web-Server" |
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/,"") |
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
| 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
| 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" |
OlderNewer