Skip to content

Commit

Permalink
Added RedHat/CentOS support to postfix cookbook
Browse files Browse the repository at this point in the history
Signed-off-by: jtimberman <joshua@opscode.com>
  • Loading branch information
Adam Mielke authored and jtimberman committed Apr 9, 2012
1 parent a2c0c7c commit 002bcb8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
recipe "postfix", "Installs and configures postfix"
recipe "postfix::sasl_auth", "Set up postfix to auth to a server with sasl"

%w{ubuntu debian}.each do |os|
%w{ubuntu debian redhat centos}.each do |os|
supports os
end

Expand Down
20 changes: 18 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,24 @@
action :install
end

service "postfix" do
action :enable
case node[:platform]
when "ubuntu", "debian"
service "postfix" do
action :enable
end
when "redhat", "centos"
service "postfix" do
action :nothing
end
service "sendmail" do
action :nothing
end
execute "switch_mailer_to_postfix" do
command "/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix"
notifies :stop, resources(:service => "sendmail")
notifies :start, resources(:service => "postfix")
not_if "/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix"
end
end

%w{main master}.each do |cfg|
Expand Down

0 comments on commit 002bcb8

Please sign in to comment.