Installs the tgt gateway

Currently relies on the client.admin key being installed on the system
This commit is contained in:
Walter Huf 2013-11-18 12:01:31 -06:00 committed by Walter Huf
parent f2262864e6
commit 80250e5fba
5 changed files with 91 additions and 0 deletions

View File

@ -3,6 +3,7 @@ default['ceph']['branch'] = "stable" # Can be stable, testing or dev.
default['ceph']['version'] = "dumpling"
default['ceph']['el_add_epel'] = true
default['ceph']['repo_url'] = "http://ceph.com"
default['ceph']['extras_repo_url'] = "http://ceph.com/packages/ceph-extras"
case node['platform_family']
when "debian"
@ -13,18 +14,24 @@ when "debian"
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"
default['ceph']['debian']['extras']['repository'] = "#{node['ceph']['extras_repo_url']}/debian/"
default['ceph']['debian']['extras']['repository_key'] = "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc"
when "rhel"
#Redhat/CentOS default repositories
default['ceph']['rhel']['stable']['repository'] = "#{node['ceph']['repo_url']}/rpm-#{node['ceph']['version']}/el6/noarch/ceph-release-1-0.el6.noarch.rpm"
default['ceph']['rhel']['testing']['repository'] = "#{node['ceph']['repo_url']}/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"
default['ceph']['rhel']['extras']['repository'] = "#{node['ceph']['extras_repo_url']}/rpm/rhel6/x86_64/"
default['ceph']['rhel']['extras']['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'] = "#{node['ceph']['repo_url']}/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'] = "#{node['ceph']['repo_url']}/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"
default['ceph']['fedora']['extras']['repository'] = "#{node['ceph']['extras_repo_url']}/rpm/fedora#{node['platform_version']}/x86_64/"
default['ceph']['fedora']['extras']['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
@ -35,6 +42,7 @@ when "suse"
suse_version = suse << %x[ grep VERSION /etc/SuSE-release | awk -F'= ' '{print $2}' ].chomp
default['ceph']['suse']['stable']['repository'] = "#{node['ceph']['repo_url']}/rpm-#{node['ceph']['version']}/#{suse_version}/x86_64/ceph-release-1-0.#{suse_version}.noarch.rpm"
default['ceph']['suse']['testing']['repository'] = "#{node['ceph']['repo_url']}/rpm-testing/#{suse_version}/x86_64/ceph-release-1-0.#{suse_version}.noarch.rpm"
default['ceph']['suse']['extras']['repository'] = "#{node['ceph']['extras_repo_url']}/rpm/#{suse_version}/x86_64/"
else
raise "#{node['platform_family']} is not supported"
end

View File

@ -10,6 +10,16 @@ apt_repository "ceph-#{branch}" do
key node['ceph']['debian'][branch]['repository_key']
end
if node['roles'].include?("ceph-tgt")
apt_repository "ceph-extras-#{branch}" do
repo_name "ceph-extras"
uri node['ceph']['debian']['extras']['repository']
distribution node['lsb']['codename'] == "jessie" ? "sid" : node['lsb']['codename']
components ['main']
key node['ceph']['debian']['extras']['repository_key']
end
end
if node['roles'].include?("ceph-radosgw") \
&& node["ceph"]["radosgw"]["webserver_companion"] == "apache2" \
&& node["ceph"]["radosgw"]["use_apache_fork"] == true

View File

@ -34,3 +34,16 @@ else
#This is a stable or testing branch
system "rpm -U #{node['ceph'][platform_family][branch]['repository']}"
end
if node['roles'].include?("ceph-tgt")
repo = node['ceph'][platform_family]['extras']['repository']
system "curl -s #{node['ceph'][platform_family]['extras']['repository_key']} > /etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH-EXTRAS"
system "cat > /etc/yum.repos.d/ceph.repo << EOF\n" \
"[ceph]\n" \
"name=Ceph\n" \
"baseurl=#{repo}\n" \
"enabled=1\n" \
"gpgcheck=1\n" \
"gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CEPH-EXTRAS\n" \
"EOF\n"
end

54
recipes/tgt.rb Normal file
View File

@ -0,0 +1,54 @@
#
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
# Cookbook Name:: ceph
# Recipe:: radosgw
#
# Copyright 2011, DreamHost Web Hosting
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
case node['platform_family']
when "debian"
packages = %w{
tgt
}
when "rhel","fedora"
packages = %w{
scsi-target-utils
}
end
packages.each do |pkg|
package pkg do
action :upgrade
end
end
include_recipe "ceph::conf"
# probably needs the key
service "tgt" do
case node["ceph"]["radosgw"]["init_style"]
when "upstart"
service_name "tgt"
provider Chef::Provider::Service::Upstart
else
if node['platform'] == "debian"
service_name "tgt"
else
service_name "tgt"
end
end
supports :restart => true
action [ :enable, :start ]
end

6
roles/ceph-tgt.rb Normal file
View File

@ -0,0 +1,6 @@
name "ceph-tgt"
description "Ceph iSCSI Target"
run_list(
'recipe[ceph::repo]',
'recipe[ceph::tgt]'
)