Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Commit

Permalink
Fixing obvious bugs, removing the use of the iptables recipe, since i…
Browse files Browse the repository at this point in the history
…t's really not the way it should be done in Chef
  • Loading branch information
adamhjk committed Jan 18, 2009
1 parent 1f10b25 commit ee42cde
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 50 deletions.
25 changes: 8 additions & 17 deletions apache2/recipes/default.rb
Expand Up @@ -17,30 +17,28 @@
# limitations under the License.
#

include_recipe "iptables"

package "apache2" do
case node[:platform]
when "CentOS","RedHat","Fedora","SuSE"
when "centos","redhat","fedora","suse"
name "httpd"
when "Debian","Ubuntu"
when "debian","ubuntu"
name "apache2"
end
action :install
end

service "apache2" do
case node[:platform]
when "CentOS","RedHat","Fedora","SuSE"
when "centos","redhat","fedora","suse"
name "httpd"
when "Debian","Ubuntu"
when "debian","ubuntu"
name "apache2"
end
supports :restart => true
action :enable
end

if platform?("CentOS", "RedHat", "Fedora", "SuSE")
if platform?("centos", "redhat", "fedora", "suse")
directory node[:apache][:log_dir] do
mode 0755
action :create
Expand Down Expand Up @@ -86,9 +84,9 @@

template "apache2.conf" do
case node[:platform]
when "CentOS","RedHat","Fedora"
when "centos","redhat","fedora"
path "#{node[:apache][:dir]}/conf/httpd.conf"
when "Debian","Ubuntu"
when "debian","ubuntu"
path "#{node[:apache][:dir]}/apache2.conf"
end
source "apache2.conf.erb"
Expand All @@ -105,13 +103,6 @@
mode 0644
end

node[:apache][:listen_ports].each do |port|
iptables_rule "port_#{port}" do
source "port_apache.erb"
variables :port => port
end
end

template "#{node[:apache][:dir]}/sites-available/default" do
source "default-site.erb"
owner "root"
Expand All @@ -134,7 +125,7 @@
include_recipe "apache2::mod_mime"
include_recipe "apache2::mod_negotiation"
include_recipe "apache2::mod_setenvif"
include_recipe "apache2::mod_log_config" if platform?("CentOS", "RedHat", "SuSE")
include_recipe "apache2::mod_log_config" if platform?("centos", "redhat", "suse")

service "apache2" do
action :start
Expand Down
4 changes: 2 additions & 2 deletions apache2/recipes/mod_fcgid.rb
Expand Up @@ -17,9 +17,9 @@
# limitations under the License.
#

if platform?("Debian", "Ubuntu")
if platform?("debian", "ubuntu")
package "libapache2-mod-fcgid"
elsif platform?("CentOS", "RedHat", "SuSE")
elsif platform?("centos", "redhat", "suse")
apache_lib_path = node[:architecture] == "i386" ? "/usr/lib/httpd" : "/usr/lib64/httpd"
package "httpd-devel"
bash "install-fcgid" do
Expand Down
4 changes: 2 additions & 2 deletions build-essential/recipes/default.rb
Expand Up @@ -18,13 +18,13 @@
#

case node[:platform]
when "Ubuntu","Debian"
when "ubuntu","debian"
%w{build-essential binutils-doc}.each do |pkg|
package pkg do
action :install
end
end
when "CentOS"
when "centos"
package "gcc" do
action :install
end
Expand Down
4 changes: 0 additions & 4 deletions chef/recipes/server.rb
Expand Up @@ -34,7 +34,3 @@

runit_service "chef-indexer"
runit_service "chef-server"

["couchdb", "chef"].each do |port|
iptables_rule "port_#{port}"
end
4 changes: 0 additions & 4 deletions munin/recipes/default.rb
Expand Up @@ -17,8 +17,6 @@
# limitations under the License.
#

include_recipe "iptables"

package "munin-node"

service "munin-node" do
Expand All @@ -37,5 +35,3 @@
variables :munin_server_regexs => munin_server_regexs
notifies :restart, resources(:service => "munin-node")
end

iptables_rule "port_munin"
4 changes: 2 additions & 2 deletions mysql/recipes/client.rb
Expand Up @@ -19,15 +19,15 @@

package "mysql-devel" do
package_name value_for_platform(
[ "CentOS", "RedHat", "SuSE" ] => { "default" => "mysql-devel" },
[ "centos", "redhat", "suse" ] => { "default" => "mysql-devel" },
"default" => 'libmysqlclient15-dev'
)
action :install
end

package "mysql-client" do
package_name value_for_platform(
[ "CentOS", "RedHat", "SuSE" ] => { "default" => "mysql" },
[ "centos", "redhat", "suse" ] => { "default" => "mysql" },
"default" => "mysql-client"
)
action :install
Expand Down
5 changes: 1 addition & 4 deletions mysql/recipes/server.rb
Expand Up @@ -16,7 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe "iptables"

include_recipe "mysql::client"

Expand All @@ -29,14 +28,12 @@
action :enable
end

iptables_rule "port_mysql"

if (node[:ec2] && ! FileTest.directory?(node[:mysql_ec2_path]))

mysql_server_path = ""

case node[:platform]
when "Ubuntu","Debian"
when "ubuntu","debian"
mysql_server_path = "/var/lib/mysql"
else
mysql_server_path = "/var/mysql"
Expand Down
8 changes: 2 additions & 6 deletions openssh/recipes/default.rb
Expand Up @@ -17,10 +17,8 @@
# limitations under the License.
#

include_recipe "iptables"

packages = case node[:platform]
when "CentOS","RedHat","Fedora"
when "centos","redhat","fedora"
%w{openssh-clients openssh}
else
%w{openssh-client openssh-server}
Expand All @@ -32,7 +30,7 @@

service "ssh" do
case node[:platform]
when "CentOS","RedHat","Fedora"
when "centos","redhat","fedora"
service_name "sshd"
else
service_name "ssh"
Expand All @@ -41,5 +39,3 @@
action [ :enable, :start ]
end

iptables_rule "port_ssh"

3 changes: 0 additions & 3 deletions redmine/recipes/default.rb
Expand Up @@ -18,10 +18,7 @@
# limitations under the License.
#
# Get prerequisite recipes.
include_recipe "iptables"
include_recipe "subversion"
include_recipe "mysql::server"

runit_service "redmine"

iptables_rule "port_redmine"
4 changes: 2 additions & 2 deletions subversion/recipes/default.rb
Expand Up @@ -22,13 +22,13 @@
end

extra_packages = case node[:platform]
when "Ubuntu","Debian"
when "ubuntu","debian"
if node[:platform_version].to_f < 8.04
%w{subversion-tools libsvn-core-perl}
else
%w{subversion-tools libsvn-perl}
end
when "CentOS","RedHat","Fedora"
when "centos","redhat","fedora"
%w{subversion-devel subversion-perl}
end

Expand Down
5 changes: 1 addition & 4 deletions teamspeak/recipes/default.rb
Expand Up @@ -15,11 +15,8 @@
# 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.
include_recipe "iptables"

package "teamspeak-server"
service "teamspeak-server" do
action :enable
end

iptables_rule "port_teamspeak"
end

0 comments on commit ee42cde

Please sign in to comment.