Skip to content

Commit

Permalink
FIXME: test mgr deploy
Browse files Browse the repository at this point in the history
create keyring
enable target
  • Loading branch information
bmwiedemann authored and dirkmueller committed Oct 18, 2018
1 parent be58b46 commit 894b193
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions chef/cookbooks/ceph/recipes/mon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

mon_name = get_ceph_client_name(node)

package "ceph-mgr"
package "ceph-mon"
directory "/var/lib/ceph/mon/ceph-#{mon_name}" do
owner "ceph"
group "ceph"
Expand All @@ -30,9 +32,50 @@
action :create
end

directory "/var/lib/ceph/mgr/ceph-#{mon_name}" do
owner "ceph"
group "ceph"
mode "0750"
recursive true
action :create
end


# TODO cluster name
cluster = "ceph"


unless File.exist?("/var/lib/ceph/mgr/ceph-#{mon_name}/done")
keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{mon_name}.mgr.keyring"
execute "create mgr keyring" do
command "ceph-authtool '#{keyring}' --create-keyring --name=mgr. --add-key='#{node["ceph"]["monitor-secret"]}' --cap mgr 'allow *'"
not_if { node["ceph"]["monitor-secret"].empty? }
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 @@ -143,6 +186,9 @@
service "ceph-mon.target" do
action :enable
end
service "ceph-mgr.target" do
action :enable
end
service "ceph.target" do
action :enable
end
Expand Down

0 comments on commit 894b193

Please sign in to comment.