]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
create 'done' file (and friends) for ubuntu only
authorJiří Suchomel <jsuchome@suse.cz>
Thu, 25 Sep 2014 09:02:48 +0000 (11:02 +0200)
committerJiří Suchomel <jsuchome@suse.cz>
Thu, 25 Sep 2014 09:02:48 +0000 (11:02 +0200)
recipes/mon.rb

index f69e679cd1bbecee4f301b57e006f6463dc775be..d98c7b5498241bc06b1c290b469e60208220124d 100644 (file)
@@ -41,44 +41,44 @@ end
 # TODO: cluster name
 cluster = 'ceph'
 
-unless File.exist?("/var/lib/ceph/mon/ceph-#{node['hostname']}/done")
-  keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
+keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
 
-  execute 'format mon-secret as keyring' do
-    command lazy { "ceph-authtool '#{keyring}' --create-keyring --name=mon. --add-key='#{mon_secret}' --cap mon 'allow *'" }
-    creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
-    only_if { mon_secret }
-  end
+execute 'format mon-secret as keyring' do
+  command lazy { "ceph-authtool '#{keyring}' --create-keyring --name=mon. --add-key='#{mon_secret}' --cap mon 'allow *'" }
+  creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
+  only_if { mon_secret }
+end
 
-  execute 'generate mon-secret as keyring' do
-    command "ceph-authtool '#{keyring}' --create-keyring --name=mon. --gen-key --cap mon 'allow *'"
-    creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
-    not_if { mon_secret }
-    notifies :create, 'ruby_block[save mon_secret]', :immediately
-  end
+execute 'generate mon-secret as keyring' do
+  command "ceph-authtool '#{keyring}' --create-keyring --name=mon. --gen-key --cap mon 'allow *'"
+  creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
+  not_if { mon_secret }
+  notifies :create, 'ruby_block[save mon_secret]', :immediately
+end
 
-  ruby_block 'save mon_secret' do
-    block do
-      fetch = Mixlib::ShellOut.new("ceph-authtool '#{keyring}' --print-key --name=mon.")
-      fetch.run_command
-      key = fetch.stdout
-      node.set['ceph']['monitor-secret'] = key
-      node.save
-    end
-    action :nothing
+ruby_block 'save mon_secret' do
+  block do
+    fetch = Mixlib::ShellOut.new("ceph-authtool '#{keyring}' --print-key --name=mon.")
+    fetch.run_command
+    key = fetch.stdout
+    node.set['ceph']['monitor-secret'] = key
+    node.save
   end
+  action :nothing
+end
 
-  execute 'ceph-mon mkfs' do
-    command "ceph-mon --mkfs -i #{node['hostname']} --keyring '#{keyring}'"
-  end
+execute 'ceph-mon mkfs' do
+  command "ceph-mon --mkfs -i #{node['hostname']} --keyring '#{keyring}'"
+end
 
-  ruby_block 'finalise' do
-    block do
-      ['done', service_type].each do |ack|
-        ::File.open("/var/lib/ceph/mon/ceph-#{node['hostname']}/#{ack}", 'w').close
-      end
+# needed only by https://github.com/ceph/ceph/blob/master/src/upstart/ceph-mon-all-starter.conf
+ruby_block 'finalise' do
+  block do
+    ['done', service_type].each do |ack|
+      ::File.open("/var/lib/ceph/mon/ceph-#{node['hostname']}/#{ack}", 'w').close
     end
   end
+  only_if { node['platform'] == 'ubuntu' }
 end
 
 if service_type == 'upstart'