include_recipe "ceph::default"
include_recipe "ceph::conf"
-service "ceph-mon-all-starter" do
- provider Chef::Provider::Service::Upstart
- action [:enable]
+service_type = service_type()
+service "ceph_mon" do
+ case service_type
+ when "upstart"
+ service_name "ceph-mon-all-starter"
+ provider Chef::Provider::Service::Upstart
+ action :enable
+ when "sysvinit"
+ service_name "ceph"
+ provider Chef::Provider::Service::Init
+ end
+ supports :restart => true
end
+
# TODO cluster name
cluster = 'ceph'
ceph-mon --mkfs -i #{node['hostname']} --keyring "$KR"
rm -f -- "$KR"
touch /var/lib/ceph/mon/ceph-#{node['hostname']}/done
-touch /var/lib/ceph/mon/ceph-#{node['hostname']}/upstart
+touch /var/lib/ceph/mon/ceph-#{node['hostname']}/#{service_type}
EOH
creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done'
- creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/upstart'
- notifies :start, "service[ceph-mon-all-starter]", :immediately
+ creates "/var/lib/ceph/mon/ceph-#{node["hostname"]}/#{service_type}"
+ notifies :start, "service[ceph_mon]", :immediately
end
ruby_block "tell ceph-mon about its peers" do
end
end
-service "ceph-osd-all" do
- provider Chef::Provider::Service::Upstart
- service_name "ceph-osd-all"
+service_type = service_type()
+service "ceph_osd" do
+ case service_type
+ when "sysvinit"
+ service_name "ceph"
+ provider Chef::Provider::Service::Init
+ when "upstart"
+ service_name "ceph-osd-all"
+ provider Chef::Provider::Service::Upstart
+ action :enable
+ end
supports :restart => true
- action :enable
end
mons = get_mon_nodes("ceph_bootstrap_osd_key:*")
execute "Creating Ceph OSD on #{osd_device['device']}" do
command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']}"
action :run
- notifies :start, "service[ceph-osd-all]", :immediately
+ notifies :start, "service[ceph_osd]", :immediately
end
# we add this status to the node env
# so that we can implement recreate