Skip to content

Commit ea74a75

Browse files
committed
mgr: move to end of file
so that admin keyring is already created
1 parent 9bbb603 commit ea74a75

File tree

1 file changed

+41
-44
lines changed
  • chef/cookbooks/ceph/recipes

1 file changed

+41
-44
lines changed

chef/cookbooks/ceph/recipes/mon.rb

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,53 +32,9 @@
3232
action :create
3333
end
3434

35-
directory "/var/lib/ceph/mgr/ceph-#{mon_name}" do
36-
owner "ceph"
37-
group "ceph"
38-
mode "0750"
39-
recursive true
40-
action :create
41-
end
42-
43-
4435
# TODO cluster name
4536
cluster = "ceph"
4637

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-
8238
unless File.exist?("/var/lib/ceph/mon/ceph-#{mon_name}/done")
8339
keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{mon_name}.mon.keyring"
8440

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

0 commit comments

Comments
 (0)