Skip to content

Commit 0a96245

Browse files
committed
mgr: move to end of file
so that admin keyring is already created
1 parent 0e4b9f5 commit 0a96245

File tree

1 file changed

+34
-36
lines changed
  • chef/cookbooks/ceph/recipes

1 file changed

+34
-36
lines changed

chef/cookbooks/ceph/recipes/mon.rb

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,45 +40,9 @@
4040
action :create
4141
end
4242

43-
4443
# TODO cluster name
4544
cluster = "ceph"
4645

47-
48-
unless File.exist?("/var/lib/ceph/mgr/ceph-#{mon_name}/done")
49-
keyring = "/var/lib/ceph/mgr/#{cluster}-#{mon_name}/keyring"
50-
execute "create mgr keyring" do
51-
command "ceph auth get-or-create mgr.#{mon_name} \
52-
mon 'allow profile mgr' osd 'allow *' mds 'allow *' \
53-
-o #{keyring} && \
54-
chown ceph.ceph #{keyring}"
55-
not_if { File.exist?(keyring) }
56-
end
57-
ruby_block "finalise" do
58-
block do
59-
["done"].each do |ack|
60-
File.open("/var/lib/ceph/mgr/ceph-#{mon_name}/#{ack}", "w").close
61-
end
62-
end
63-
end
64-
end
65-
66-
service "ceph_mgr" do
67-
case service_type
68-
when "upstart"
69-
service_name "ceph-mgr-all-starter"
70-
provider Chef::Provider::Service::Upstart
71-
when "systemd"
72-
service_name "ceph-mgr@#{mon_name}"
73-
else
74-
service_name "ceph"
75-
end
76-
supports restart: true, status: true
77-
action [:enable, :start]
78-
subscribes :restart, resources(template: "/etc/ceph/ceph.conf")
79-
end
80-
81-
8246
unless File.exist?("/var/lib/ceph/mon/ceph-#{mon_name}/done")
8347
keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{mon_name}.mon.keyring"
8448

@@ -236,3 +200,37 @@
236200
end
237201
end
238202
end
203+
204+
205+
unless File.exist?("/var/lib/ceph/mgr/ceph-#{mon_name}/done")
206+
keyring = "/var/lib/ceph/mgr/#{cluster}-#{mon_name}/keyring"
207+
execute "create mgr keyring" do
208+
command "ceph auth get-or-create mgr.#{mon_name} \
209+
mon 'allow profile mgr' osd 'allow *' mds 'allow *' \
210+
-o #{keyring} && \
211+
chown ceph.ceph #{keyring}"
212+
not_if { File.exist?(keyring) }
213+
end
214+
ruby_block "finalise" do
215+
block do
216+
["done"].each do |ack|
217+
File.open("/var/lib/ceph/mgr/ceph-#{mon_name}/#{ack}", "w").close
218+
end
219+
end
220+
end
221+
end
222+
223+
service "ceph_mgr" do
224+
case service_type
225+
when "upstart"
226+
service_name "ceph-mgr-all-starter"
227+
provider Chef::Provider::Service::Upstart
228+
when "systemd"
229+
service_name "ceph-mgr@#{mon_name}"
230+
else
231+
service_name "ceph"
232+
end
233+
supports restart: true, status: true
234+
action [:enable, :start]
235+
subscribes :restart, resources(template: "/etc/ceph/ceph.conf")
236+
end

0 commit comments

Comments
 (0)