Skip to content

Commit b965ec1

Browse files
bmwiedemanndirkmueller
authored andcommitted
ceph: deploy ceph-mgr
Deploy it after the admin keyring creation.
1 parent be58b46 commit b965ec1

File tree

1 file changed

+47
-0
lines changed
  • chef/cookbooks/ceph/recipes

1 file changed

+47
-0
lines changed

chef/cookbooks/ceph/recipes/mon.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
mon_name = get_ceph_client_name(node)
2424

25+
package "ceph-mgr"
26+
package "ceph-mon"
2527
directory "/var/lib/ceph/mon/ceph-#{mon_name}" do
2628
owner "ceph"
2729
group "ceph"
@@ -30,6 +32,14 @@
3032
action :create
3133
end
3234

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+
3343
# TODO cluster name
3444
cluster = "ceph"
3545

@@ -143,6 +153,9 @@
143153
service "ceph-mon.target" do
144154
action :enable
145155
end
156+
service "ceph-mgr.target" do
157+
action :enable
158+
end
146159
service "ceph.target" do
147160
action :enable
148161
end
@@ -187,3 +200,37 @@
187200
end
188201
end
189202
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)