Browse files

Centos 6 support

  • Loading branch information...
1 parent 0c0bacf commit fef2ef45648bb5eb86a5a7586bfed95018ca2e7f @ivey ivey committed Apr 16, 2012
Showing with 31 additions and 8 deletions.
  1. +31 −8 recipes/default.rb
View
39 recipes/default.rb
@@ -18,6 +18,8 @@
# limitations under the License.
#
+centos6 = (node['platform'] == 'centos' && Chef::VersionConstraint.new("~> 6.0").include?(node['platform_version']))
+
case node['platform']
when 'ubuntu'
if Chef::VersionConstraint.new("<= 10.04").include?(node['platform_version'])
@@ -61,25 +63,46 @@
end
end
when 'centos', 'redhat', 'fedora'
- # Configure IUS repo
- # http://rob.olmos.name/2010/08/centos-5-5-php-5-3-3-php-fpm-nginx-rpms/
- # TODO: verify this is the best repo
- yum_repository "ius" do
- url "http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/$basearch"
- action :add
+ if centos6
+ # Configure REMI and EPEL
+ # http://www.lifelinux.com/how-to-install-nginx-and-php-fpm-on-centos-6-via-yum/
+ include_recipe "yum::epel"
+
+ yum_key "RPM-GPG-KEY-remi" do
+ url "http://rpms.famillecollet.com/RPM-GPG-KEY-remi"
+ action :add
+ end
+
+ yum_repository "remi" do
+ name "Les RPM de remi pour Enterprise Linux $releasever - $basearch"
+ url "http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror"
+ mirrorlist true
+ key "RPM-GPG-KEY-remi"
+ action :add
+ end
+ else
+ # Configure IUS repo
+ # http://rob.olmos.name/2010/08/centos-5-5-php-5-3-3-php-fpm-nginx-rpms/
+ # TODO: verify this is the best repo
+ yum_repository "ius" do
+ url "http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/$basearch"
+ action :add
+ end
end
end
pkgs = value_for_platform(
%w{ centos redhat fedora } => {
- "default" => %w{ php53u-fpm and php53u-pecl-apc }
+ "default" => %w{ php53u-fpm php53u-pecl-apc }
},
%w{ debian ubuntu } => {
"default" => %w{ php5-cgi php5-fpm }
},
"default" => %w{ php5-cgi php5-fpm }
)
+pkgs = %w{php php-fpm php-common php-cli php-pear} if centos6
+
unless platform?(%w{ centos redhat fedora })
# TODO: look into the php53u-*/php53-* conflict
require_recipe 'php::default'
@@ -89,4 +112,4 @@
package pkg do
action :upgrade
end
-end
+end

1 comment on commit fef2ef4

@patcon

Not sure if I think it's the best way myself, but just a heads up that libraries are sometimes used for little helper functions like `centos6?:

https://github.com/opscode-cookbooks/mysql/blob/master/recipes/client.rb#L22
https://github.com/opscode-cookbooks/mysql/blob/master/libraries/helpers.rb

Seems like it might be a layer of indirection, but to each their own :)

Please sign in to comment.