Skip to content

Commit

Permalink
mgr: move to end of file
Browse files Browse the repository at this point in the history
so that admin keyring is already created
  • Loading branch information
bmwiedemann committed Oct 4, 2018
1 parent 0e4b9f5 commit 0a96245
Showing 1 changed file with 34 additions and 36 deletions.
70 changes: 34 additions & 36 deletions chef/cookbooks/ceph/recipes/mon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,45 +40,9 @@
action :create
end


# TODO cluster name
cluster = "ceph"


unless File.exist?("/var/lib/ceph/mgr/ceph-#{mon_name}/done")
keyring = "/var/lib/ceph/mgr/#{cluster}-#{mon_name}/keyring"
execute "create mgr keyring" do
command "ceph auth get-or-create mgr.#{mon_name} \
mon 'allow profile mgr' osd 'allow *' mds 'allow *' \
-o #{keyring} && \
chown ceph.ceph #{keyring}"
not_if { File.exist?(keyring) }
end
ruby_block "finalise" do
block do
["done"].each do |ack|
File.open("/var/lib/ceph/mgr/ceph-#{mon_name}/#{ack}", "w").close
end
end
end
end

service "ceph_mgr" do
case service_type
when "upstart"
service_name "ceph-mgr-all-starter"
provider Chef::Provider::Service::Upstart
when "systemd"
service_name "ceph-mgr@#{mon_name}"
else
service_name "ceph"
end
supports restart: true, status: true
action [:enable, :start]
subscribes :restart, resources(template: "/etc/ceph/ceph.conf")
end


unless File.exist?("/var/lib/ceph/mon/ceph-#{mon_name}/done")
keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{mon_name}.mon.keyring"

Expand Down Expand Up @@ -236,3 +200,37 @@
end
end
end


unless File.exist?("/var/lib/ceph/mgr/ceph-#{mon_name}/done")
keyring = "/var/lib/ceph/mgr/#{cluster}-#{mon_name}/keyring"
execute "create mgr keyring" do
command "ceph auth get-or-create mgr.#{mon_name} \
mon 'allow profile mgr' osd 'allow *' mds 'allow *' \
-o #{keyring} && \
chown ceph.ceph #{keyring}"
not_if { File.exist?(keyring) }
end
ruby_block "finalise" do
block do
["done"].each do |ack|
File.open("/var/lib/ceph/mgr/ceph-#{mon_name}/#{ack}", "w").close
end
end
end
end

service "ceph_mgr" do
case service_type
when "upstart"
service_name "ceph-mgr-all-starter"
provider Chef::Provider::Service::Upstart
when "systemd"
service_name "ceph-mgr@#{mon_name}"
else
service_name "ceph"
end
supports restart: true, status: true
action [:enable, :start]
subscribes :restart, resources(template: "/etc/ceph/ceph.conf")
end

0 comments on commit 0a96245

Please sign in to comment.