Merge pull request #31 from ceph/wip-repo

Wip repo
This commit is contained in:
Sage Weil 2013-05-15 23:35:20 -07:00
commit 79f763f58a
7 changed files with 64 additions and 53 deletions

View File

@ -2,3 +2,38 @@ default['ceph']['branch'] = "stable" # Can be stable, testing or dev.
# Major release version to install or gitbuilder branch
default['ceph']['version'] = "cuttlefish"
default['ceph']['el_add_epel'] = true
case node['platform_family']
when "debian"
#Debian/Ubuntu default repositories
default['ceph']['debian']['stable']['repository'] = "http://ceph.com/debian-#{node['ceph']['version']}/"
default['ceph']['debian']['stable']['repository_key'] = "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc"
default['ceph']['debian']['testing']['repository'] = "http://www.ceph.com/debian-testing/"
default['ceph']['debian']['testing']['repository_key'] = "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc"
default['ceph']['debian']['dev']['repository'] = "http://gitbuilder.ceph.com/ceph-deb-#{node['lsb']['codename']}-x86_64-basic/ref/#{node['ceph']['version']}"
default['ceph']['debian']['dev']['repository_key'] = "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
when "rhel"
#Redhat/CentOS default repositories
default['ceph']['rhel']['stable']['repository'] = "http://ceph.com/rpm-#{node['ceph']['version']}/el6/x86_64/ceph-release-1-0.el6.noarch.rpm"
default['ceph']['rhel']['testing']['repository'] = "http://ceph.com/rpm-testing/el6/x86_64/ceph-release-1-0.el6.noarch.rpm"
default['ceph']['rhel']['dev']['repository'] = "http://gitbuilder.ceph.com/ceph-rpm-centos6-x86_64-basic/ref/#{node['ceph']['version']}/x86_64/"
default['ceph']['rhel']['dev']['repository_key'] = "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
when "fedora"
#Fedora default repositories
default['ceph']['fedora']['stable']['repository'] = "http://ceph.com/rpm-#{node['ceph']['version']}/fc#{node['platform_version']}/x86_64/ceph-release-1-0.fc#{node['platform_version']}.noarch.rpm"
default['ceph']['fedora']['testing']['repository'] = "http://ceph.com/rpm-testing/fc#{node['platform_version']}/x86_64/ceph-release-1-0.fc#{node['platform_version']}.noarch.rpm"
default['ceph']['fedora']['dev']['repository'] = "http://gitbuilder.ceph.com/ceph-rpm-fc#{node['platform_version']}-x86_64-basic/ref/#{node['ceph']['version']}/RPMS/x86_64/"
default['ceph']['fedora']['dev']['repository_key'] = "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
when "suse"
#(Open)SuSE default repositories
# Chef doesn't make a difference between suse and opensuse
suse = %x[ head -n1 /etc/SuSE-release| awk '{print $1}' ].chomp.downcase #can be suse or opensuse
if suse == "suse"
suse = "sles"
end
suse_version = suse << %x[ grep VERSION /etc/SuSE-release | awk -F'= ' '{print $2}' ].chomp
default['ceph']['suse']['stable']['repository'] = "http://ceph.com/rpm-#{node['ceph']['version']}/#{suse_version}/x86_64/ceph-release-1-0.#{suse_version}.noarch.rpm"
default['ceph']['suse']['testing']['repository'] = "http://www.ceph.com/rpm-testing/#{suse_version}/x86_64/ceph-release-1-0.#{suse_version}.noarch.rpm"
else
raise "#{node['platform_family']} is not supported"
end

View File

@ -1,29 +1,12 @@
include_recipe "apt"
case node['ceph']['branch']
when "stable"
apt_repository "ceph-stable" do
repo_name "ceph"
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"
end
when "testing"
apt_repository "ceph-testing" do
repo_name "ceph"
uri "http://www.ceph.com/debian-testing/"
distribution node['lsb']['codename']
components ["main"]
key "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc"
end
when "dev"
apt_repository "ceph-gitbuilder" do
repo_name "ceph"
uri "http://gitbuilder.ceph.com/ceph-deb-#{node['lsb']['codename']}-x86_64-basic/ref/#{node['ceph']['version']}"
distribution node['lsb']['codename']
components ["main"]
key "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc"
end
branch = node['ceph']['branch']
apt_repository "ceph-#{branch}" do
repo_name "ceph"
uri node['ceph']['debian'][branch]['repository']
distribution node['lsb']['codename']
components ['main']
key node['ceph']['debian'][branch]['repository_key']
end

View File

@ -1,47 +1,36 @@
case node['platform_family']
platform_family = node['platform_family']
case 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
version = node['platform_version'].to_i
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
branch = node['ceph']['branch']
if branch == "dev" and platform_family != "centos" and platform_family != "fedora"
raise "Dev branch for #{platform_family} is not yet supported"
end
repo = node['ceph'][platform_family][branch]['repository']
if branch == "dev"
# 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 "curl -s node['ceph'][#{platform_family}]['dev']['repository_key'] > /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" \
"baseurl=#{repo}\n" \
"enabled=1\n" \
"gpgcheck=1\n" \
"gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH\n" \
"EOF\n"
else
#This is a stable or testing branch
system "rpm -U #{node['ceph'][platform_family][branch]['repository']}"
end

View File

@ -1,5 +1,6 @@
name "ceph-mds"
description "Ceph Metadata Server"
run_list(
'recipe[ceph::repo]',
'recipe[ceph::mds]'
)

View File

@ -1,5 +1,6 @@
name "ceph-mon"
description "Ceph Monitor"
run_list(
'recipe[ceph::repo]',
'recipe[ceph::mon]'
)

View File

@ -1,5 +1,6 @@
name "ceph-osd"
description "Ceph Object Storage Device"
run_list(
'recipe[ceph::repo]',
'recipe[ceph::osd]'
)

View File

@ -1,5 +1,6 @@
name "ceph-radosgw"
description "Ceph RADOS Gateway"
run_list(
'recipe[ceph::repo]',
'recipe[ceph::radosgw]'
)