]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Support EL, Fedora and (open)SuSE repo
authorAlexandre Marangone <alexandre.marangone@inktank.com>
Thu, 21 Mar 2013 17:58:38 +0000 (10:58 -0700)
committerAlexandre Marangone <alexandre.marangone@inktank.com>
Tue, 26 Mar 2013 21:55:46 +0000 (14:55 -0700)
- Recipe is now ceph::repo
- For EL, add EPEL repository for dependencies by default.
Deactivable by using el_add_epel: false under ceph: {} in
the chef environment.
- Handle package names difference between EL/FC/SuSE and Debian.

Signed-off-by: Alexandre Marangone <alexandre.marangone@inktank.com>
attributes/apt.rb [deleted file]
attributes/repo.rb [new file with mode: 0644]
recipes/apt.rb
recipes/default.rb
recipes/repo.rb [new file with mode: 0644]
recipes/rpm.rb [new file with mode: 0644]

diff --git a/attributes/apt.rb b/attributes/apt.rb
deleted file mode 100644 (file)
index 3e8804e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-default['ceph']['branch'] = "stable" # Can be stable, testing or dev.
-# Major release version to install or gitbuilder branch
-default['ceph']['version'] = "bobtail"
diff --git a/attributes/repo.rb b/attributes/repo.rb
new file mode 100644 (file)
index 0000000..c753e56
--- /dev/null
@@ -0,0 +1,4 @@
+default['ceph']['branch'] = "stable" # Can be stable, testing or dev.
+# Major release version to install or gitbuilder branch
+default['ceph']['version'] = "bobtail"
+default['ceph']['el_add_epel'] = true
index f666cb16d1c93af4727224f22670209ec7724aed..0b3dabe95c361e3ee599c5806ed2827b343d258e 100644 (file)
@@ -4,7 +4,7 @@ case node['ceph']['branch']
 when "stable"
   apt_repository "ceph-stable" do
     repo_name "ceph"
-    uri "http://www.ceph.com/debian-#{node['ceph']['version']}/"
+    uri "http://ceph.com/debian-#{node['ceph']['version']}/"
     distribution node['lsb']['codename']
     components ["main"]
     key "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc"
@@ -26,3 +26,4 @@ when "dev"
     key "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
   end
 end
+
index 327eec607081f6dfa44b16a411961f0810fb38d7..8cb93957a28a90d72981a86807a798758ea8ea6c 100644 (file)
 # 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.
-                       
-packages = %w{
-       ceph
-       ceph-common
-}
 
-if node['ceph']['install_debug']
-  packages_dbg = %w{
-    ceph-dbg
-    ceph-common-dbg
+packages = []
+
+case node['platform_family']
+when "debian"
+  packages = %w{
+      ceph
+      ceph-common
+  }
+
+  if node['ceph']['install_debug']
+    packages_dbg = %w{
+      ceph-dbg
+      ceph-common-dbg
+    }
+    packages += packages_dbg
+  end
+when "rhel", "fedora"
+  packages = %w{
+      ceph
   }
-  packages += packages_dbg
+
+  if node['ceph']['install_debug']
+    packages_dbg = %w{
+      ceph-debug
+    }
+    packages += packages_dbg
+  end
 end
 
 packages.each do |pkg|
diff --git a/recipes/repo.rb b/recipes/repo.rb
new file mode 100644 (file)
index 0000000..3f50c17
--- /dev/null
@@ -0,0 +1,8 @@
+case node['platform_family']
+when "debian"
+  include_recipe "ceph::apt"
+when "rhel", "suse"
+  include_recipe "ceph::rpm"
+else
+  raise "not supported"
+end
diff --git a/recipes/rpm.rb b/recipes/rpm.rb
new file mode 100644 (file)
index 0000000..7659271
--- /dev/null
@@ -0,0 +1,47 @@
+case node['platform_family']
+when "rhel"
+  version =  %x[ cat /etc/redhat-release | awk '{print $3}' | awk -F. '{print $1}' ].chomp
+  release = "el" + version
+  if node['ceph']['el_add_epel'] == true
+    # We need to do this since the EPEL
+    # version might change
+    epel_package = %x[ curl -s http://dl.fedoraproject.org/pub/epel/fullfilelist | grep ^#{version}/#{node['kernel']['machine']}/epel-release ].chomp
+    system "rpm -U http://dl.fedoraproject.org/pub/epel/#{epel_package}"
+  end
+when "fedora"
+  version = %x[ cat /etc/fedora-release | awk '{print $3}' ].chomp
+  release = "fc" + version
+when "suse"
+  suse = %x[ head -n1 /etc/SuSE-release| awk '{print $1}' ].chomp.downcase #can be suse or opensuse
+  version = %x[ grep VERSION /etc/SuSE-release | awk -F'= ' '{print $2}' ].chomp
+  release = suse + version
+end
+
+end_path = "/#{release}/x86_64/ceph-release-1-0.#{release}.noarch.rpm"
+case node['ceph']['branch']
+when "stable"
+  path = "http://ceph.com/rpm-#{node['ceph']['version']}" + end_path
+  system "rpm -U #{path}"
+when "testing"
+  path = "http://ceph.com/rpm-testing" + end_path
+  system "rpm -U #{path}"
+when "dev"
+  if node['platform'] == "centos"
+    baseurl="http://gitbuilder.ceph.com/ceph-rpm-centos#{version}-x86_64-basic/ref/#{node['ceph']['version']}/x86_64/"
+  elsif node['platform'] == "fedora"
+    baseurl="http://gitbuilder.ceph.com/ceph-rpm-#{release}-x86_64-basic/ref/#{node['ceph']['version']}/RPMS/x86_64/"
+  else
+    raise "repository not available for your distribution"
+  end
+  # Instead of using the yum cookbook,
+  # we do it this way. It avoids a dependency
+  system "curl -s 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc' > /etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH"
+  system "cat > /etc/yum.repos.d/ceph.repo << EOF\n" \
+    "[ceph]\n" \
+    "name=Ceph\n" \
+    "baseurl=#{baseurl}\n" \
+    "enabled=1\n" \
+    "gpgcheck=1\n" \
+    "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH\n" \
+    "EOF\n"
+end