From 002bcb80293e0fc22c1c69e5ce43cdbed1c55cfe Mon Sep 17 00:00:00 2001 From: Adam Mielke Date: Mon, 13 Feb 2012 16:51:25 -0600 Subject: [PATCH 1/3] Added RedHat/CentOS support to postfix cookbook Signed-off-by: jtimberman --- metadata.rb | 2 +- recipes/default.rb | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/metadata.rb b/metadata.rb index a9eb751..2b449c4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ version "0.8.4" 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 diff --git a/recipes/default.rb b/recipes/default.rb index 5c97fe5..6d88b45 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -22,8 +22,24 @@ package "postfix" do 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| From 251f37a272ab059fe0116088719c68d1b2408aac Mon Sep 17 00:00:00 2001 From: jtimberman Date: Mon, 9 Apr 2012 12:35:38 -0600 Subject: [PATCH 2/3] [COOK-668] - rearrange postfix service * Supported platforms (Debian and RHEL families) have status, reload and restart commands in their init scripts, we can specify those as supported by the service. * the service should be enabled at boot time on all platforms * Make sure that the service gets started at the end of the recipe since it wouldn't be started, only restarted, elsewhere. --- recipes/default.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/recipes/default.rb b/recipes/default.rb index 6d88b45..ef00f91 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -22,15 +22,13 @@ package "postfix" do action :install end +service "postfix" do + supports :status => true, :restart => true, :reload => true + action :enable +end + case node[:platform] -when "ubuntu", "debian" - service "postfix" do - action :enable - end -when "redhat", "centos" - service "postfix" do - action :nothing - end +when "redhat", "centos", "amazon", "scientific" service "sendmail" do action :nothing end @@ -51,3 +49,7 @@ end notifies :restart, resources(:service => "postfix") end end + +service "postfix" do + action :start +end From 12daf04f2cadca05119460158bf7601966080a1e Mon Sep 17 00:00:00 2001 From: jtimberman Date: Mon, 9 Apr 2012 12:38:31 -0600 Subject: [PATCH 3/3] update readme w/ rhel platform info --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index df506a4..e16a2c2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Description Installs and configures postfix for client or outbound relayhost, or to do SASL authentication. +On RHEL-family systems, sendmail will be replaced with postfix. + Requirements ============ @@ -11,6 +13,8 @@ Requirements * Ubuntu 10.04+ * Debian 6.0+ +* RHEL/CentOS/Scientific 5.7+, 6.2+ +* Amazon Linux (as of 4/9/2012) Attributes ==========