cookbook-openstack-common/recipes/ceph_client.rb
Stephan Renatus 104136bed7 Add ceph_client recipe
To use RBD as a block-storage backend, both the compute workers and the
cinder-api service need to be able to talk to the Ceph cluster.

Nova-compute makes use of the `rbd` CLI tool, cinder-api and libvirt use
librbd's Python binding.  Therefore, it might make sense to have this
"common" recipe provide the necessary infrastructure to a) reach the
ceph cluster and b) install ceph packages if need be.

Besides block storage, RBD can also be used for storing images, so
that's another reason to put this into openstack-common.

This commit also introduces a template, "ceph.client.keyring.erb", to
allow the creation of client keys from other recipes in a DRY way:

    template '/etc/ceph/client.cinder.keyring' do
      template 'ceph.client.keyring.erb'
      cookbook 'openstack-common'
      owner node['openstack']['block-storage']['user']
      group node['openstack']['block-storage']['group']
      mode '600'
      variables(
        name: rbd_user,
        key: rbd_key
      )
    end

A LWRP for this would be an improvement, but this should do for now.

Implements: blueprint rbd-for-block-storage

Change-Id: Icd046830c9542bd71fa3a1857c1f4d1bb3c41cec
2014-02-12 09:29:25 +01:00

47 lines
1.2 KiB
Ruby

# encoding: UTF-8
#
# Cookbook Name:: openstack-common
# Recipe:: ceph_client
#
# Copyright 2014, x-ion GmbH
#
# 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']
when 'ubuntu'
apt_repository 'ceph' do
uri node['openstack']['ceph']['platform']['uri']
distribution node['lsb']['codename']
components ['main']
key node['openstack']['ceph']['key-url']
end
when 'fedora', 'redhat', 'centos', 'suse' # :pragma-foodcritic: ~FC024 - won't fix this
# TODO
end
directory '/etc/ceph' do
user 'root'
group 'root'
end
template '/etc/ceph/ceph.conf' do
source 'ceph.conf.erb'
user 'root'
group 'root'
mode '644'
variables(
global: node['openstack']['ceph']['global']
)
end