From: Guilhem Lettron Date: Tue, 9 Apr 2013 12:33:56 +0000 (+0200) Subject: Place service at the end of script to ensure that service is always enable and runnin... X-Git-Tag: v0.2.0~31^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89d504f35b768ebfc362d1a8c33d95d69a09d9d1;p=ceph-cookbooks.git Place service at the end of script to ensure that service is always enable and running after chef is execute --- diff --git a/recipes/mon.rb b/recipes/mon.rb index 6522ecc..c49122d 100644 --- a/recipes/mon.rb +++ b/recipes/mon.rb @@ -20,18 +20,6 @@ include_recipe "ceph::default" include_recipe "ceph::conf" service_type = node["ceph"]["mon"]["init_style"] -service "ceph_mon" do - case service_type - when "upstart" - service_name "ceph-mon-all" - provider Chef::Provider::Service::Upstart - action :enable - when "sysvinit" - service_name "ceph" - provider Chef::Provider::Service::Init - end - supports :restart => true -end directory "/var/run/ceph" do owner "root" @@ -62,7 +50,6 @@ unless File.exists?("/var/lib/ceph/mon/ceph-#{node["hostname"]}/done") execute 'ceph-mon mkfs' do command "ceph-mon --mkfs -i #{node['hostname']} --keyring '#{keyring}'" - notifies :restart, "service[ceph_mon]", :immediately end ruby_block "finalise" do @@ -74,6 +61,19 @@ unless File.exists?("/var/lib/ceph/mon/ceph-#{node["hostname"]}/done") end end +service "ceph_mon" do + case service_type + when "upstart" + service_name "ceph-mon-all" + provider Chef::Provider::Service::Upstart + when "sysvinit" + service_name "ceph" + provider Chef::Provider::Service::Init + end + supports :restart => true + action [ :enable, :start ] +end + get_mon_addresses().each do |addr| execute "peer #{addr}" do command "ceph --admin-daemon '/var/run/ceph/ceph-mon.#{node['hostname']}.asok' add_bootstrap_peer_hint #{addr}"