Skip to content

Commit

Permalink
Centos 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ivey committed Apr 16, 2012
1 parent 0c0bacf commit fef2ef4
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions recipes/default.rb
Expand Up @@ -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'])
Expand Down Expand Up @@ -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'
Expand All @@ -89,4 +112,4 @@
package pkg do
action :upgrade
end
end
end

1 comment on commit fef2ef4

@patcon
Copy link

@patcon patcon commented on fef2ef4 May 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.