---
driver_plugin: vagrant
driver_config:
+ vagrantfile_erb: test/integration/Vagrantfile.erb
require_chef_omnibus: true
platforms:
- name: ubuntu-10.04
+ run_list:
+ - recipe[apt]
- name: ubuntu-12.04
+ run_list:
+ - recipe[apt]
- name: centos-6.4
- name: centos-5.9
run_list:
- "role[ceph-radosgw]"
attributes: *defaults
+- name: aio
+ attributes:
+ ceph:
+ config-sections:
+ global:
+ "osd journal size" : 128
+ "osd pool default size": 1
+ osd_devices:
+ - { device: "/dev/sdb" }
+ - { device: "/dev/sdc" }
+ - { device: "/dev/sdd" }
+ run_list:
+ - recipe[ceph::all_in_one]
site :opscode
metadata
+
+group :integration do
+ cookbook 'apt'
+end
-default['ceph']['install_debug'] = true
+default['ceph']['install_debug'] = false
default['ceph']['encrypted_data_bags'] = false
+
+default['ceph']['install_repo'] = true
!defined?(Chef::Recipe::Barclamp).nil?
end
-def get_mon_nodes(extra_search = nil)
+def mon_nodes
if crowbar?
mon_roles = search(:role, 'name:crowbar-* AND run_list:role\[ceph-mon\]')
unless mon_roles.empty?
search_string = "ceph_is_mon:true AND chef_environment:#{node.chef_environment}"
end
- unless extra_search.nil?
- search_string = "(#{search_string}) AND (#{extra_search})"
+ if use_cephx? && !node['ceph']['encrypted_data_bags']
+ search_string = "(#{search_string}) AND (ceph_bootstrap_osd_key:*)"
end
search(:node, search_string)
end
+def osd_secret
+ if node['ceph']['encrypted_data_bags']
+ secret = Chef::EncryptedDataBagItem.load_secret(node['ceph']['osd']['secret_file'])
+ return Chef::EncryptedDataBagItem.load('ceph', 'osd', secret)['secret']
+ else
+ return mon_nodes[0]['ceph']['bootstrap_osd_key']
+ end
+end
+
# If public_network is specified
# we need to search for the monitor IP
# in the node environment.
# primarily to local node
mons << node if node['ceph']['is_mon']
- mons += get_mon_nodes
+ mons += mon_nodes
if crowbar?
mon_ips = mons.map { |node| Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, 'admin').address }
else
def mon_secret
# find the monitor secret
mon_secret = ''
- mons = get_mon_nodes
+ mons = mon_nodes
if !mons.empty?
mon_secret = mons[0]['ceph']['monitor-secret']
elsif mons.empty? && node['ceph']['monitor-secret']
--- /dev/null
+
+include_recipe 'ceph::repo' if node['ceph']['install_repo']
--- /dev/null
+
+include_recipe 'ceph::mon'
+include_recipe 'ceph::osd'
+# include_recipe 'ceph::radosgw'
# See the License for the specific language governing permissions and
# limitations under the License.
+include_recipe 'ceph::_common'
include_recipe 'ceph::conf'
name = 'cephfs'
-fail 'fsid must be set in config' if node['ceph']['config']['fsid'].nil?
-fail 'mon_initial_members must be set in config' if node['ceph']['config']['mon_initial_members'].nil?
+# fail 'mon_initial_members must be set in config' if node['ceph']['config']['mon_initial_members'].nil?
+
+unless node['ceph']['config']['fsid']
+ Chef::Log.warn('We are genereting a new uuid for fsid')
+ require 'securerandom'
+ node.set['ceph']['config']['fsid'] = SecureRandom.uuid
+ node.save
+end
directory '/etc/ceph' do
owner 'root'
template '/etc/ceph/ceph.conf' do
source 'ceph.conf.erb'
- variables(
- :mon_addresses => mon_addresses,
- :is_rgw => node['ceph']['is_radosgw']
- )
+ variables lazy {
+ {
+ :mon_addresses => mon_addresses,
+ :is_rgw => node['ceph']['is_radosgw']
+ }
+ }
mode '0644'
end
# See the License for the specific language governing permissions and
# limitations under the License.
+include_recipe 'ceph::_common'
include_recipe 'ceph::default'
include_recipe 'ceph::conf'
# different and are created in
# /var/lib/ceph/bootstrap-{osd,mds}/ceph.keyring
+node.default['ceph']['is_mon'] = true
+
+include_recipe 'ceph::_common'
include_recipe 'ceph::default'
include_recipe 'ceph::conf'
service_type = node['ceph']['mon']['init_style']
-node.default['ceph']['is_mon'] = true
-
directory '/var/run/ceph' do
owner 'root'
group 'root'
# }
# ]
+include_recipe 'ceph::_common'
include_recipe 'ceph::default'
include_recipe 'ceph::conf'
end
service_type = node['ceph']['osd']['init_style']
-# Look for monitors with osd bootstrap keys.
-# If we're storing keys in encrypted data bags, then we'll have to trust the roles
-if use_cephx? && !node['ceph']['encrypted_data_bags']
- mons = get_mon_nodes('ceph_bootstrap_osd_key:*')
-else
- mons = get_mon_nodes
-end
-
-return 'No ceph-mon found.' if mons.empty?
directory '/var/lib/ceph/bootstrap-osd' do
owner 'root'
# TODO: cluster name
cluster = 'ceph'
-if node['ceph']['encrypted_data_bags']
- secret = Chef::EncryptedDataBagItem.load_secret(node['ceph']['osd']['secret_file'])
- osd_secret = Chef::EncryptedDataBagItem.load('ceph', 'osd', secret)['secret']
-else
- osd_secret = mons[0]['ceph']['bootstrap_osd_key']
-end
-
execute 'format as keyring' do
- command "ceph-authtool '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring' --create-keyring --name=client.bootstrap-osd --add-key='#{osd_secret}'"
+ command lazy { "ceph-authtool '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring' --create-keyring --name=client.bootstrap-osd --add-key='#{osd_secret}'" }
creates "/var/lib/ceph/bootstrap-osd/#{cluster}.keyring"
+ only_if { osd_secret }
end
if crowbar?
--- /dev/null
+Vagrant.configure("2") do |config|
+ config.vm.box = "<%= config[:box] %>"
+ config.vm.box_url = "<%= config[:box_url ]%>"
+ config.vm.provider :virtualbox do |vb|
+ vb.customize [ "storagectl", :id, "--name", "SATA Controller", "--add", "sata", "--controller", "IntelAHCI" ]
+ end
+ (0..2).each do |d|
+ config.vm.provider :virtualbox do |vb|
+ vb.customize [ "createhd", "--filename", "disk-#{d}", "--size", "1000" ]
+ vb.customize [ "storageattach", :id, "--storagectl", "SATA Controller", "--port", 3+d, "--device", 0, "--type", "hdd", "--medium", "disk-#{d}.vdi" ]
+ end
+ end
+end
--- /dev/null
+@test "ceph is running" {
+ ceph -s | grep HEALTH
+}
+
+@test "ceph is healthy" {
+ ceph -s | grep HEALTH_OK
+}