]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Simplify recipes: merge bootstrap_osd into osd.
authorTommi Virtanen <tv@inktank.com>
Thu, 2 Aug 2012 21:51:56 +0000 (14:51 -0700)
committerTommi Virtanen <tv@inktank.com>
Mon, 6 Aug 2012 20:22:56 +0000 (13:22 -0700)
recipes/bootstrap_osd.rb [deleted file]
recipes/osd.rb
roles/ceph-osd.rb

diff --git a/recipes/bootstrap_osd.rb b/recipes/bootstrap_osd.rb
deleted file mode 100644 (file)
index b5c6bc1..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# this recipe allows bootstrapping new osds, with help from mon
-
-include_recipe "ceph::osd"
-include_recipe "ceph::conf"
-
-package 'gdisk' do
-  action :upgrade
-end
-
-mons = get_mon_nodes("ceph_bootstrap_osd_key:*")
-
-if mons.empty? then
-  puts "No ceph-mon found."
-else
-
-  directory "/var/lib/ceph/bootstrap-osd" do
-    owner "root"
-    group "root"
-    mode "0755"
-  end
-
-  # TODO cluster name
-  cluster = 'ceph'
-
-  file "/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw" do
-    owner "root"
-    group "root"
-    mode "0440"
-    content mons[0]["ceph_bootstrap_osd_key"]
-  end
-
-  execute "format as keyring" do
-    command <<-EOH
-      set -e
-      # TODO don't put the key in "ps" output, stdout
-      read KEY <'/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
-      ceph-authtool '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring' --create-keyring --name=client.bootstrap-osd --add-key="$KEY"
-      rm -f '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
-    EOH
-  end
-
-  if is_crowbar?
-    ruby_block "select new disks for ceph osd" do
-      block do
-        do_trigger = false
-        node["crowbar"]["disks"].each do |disk, data|
-          use = true
-
-          if node["swift"] and node["swift"]["devs"]
-            node["swift"]["devs"].each do |num|
-              if num["name"].match(disk)
-                puts "Disk: #{disk} is being used for swift, skipping"
-                use = false
-              end
-            end
-          end
-
-          if node["crowbar"]["disks"][disk]["usage"] == "Storage" and use == true
-            puts "Disk: #{disk} should be used for ceph"
-
-            system 'ceph-disk-prepare', \
-              "/dev/#{disk}"
-            raise 'ceph-disk-prepare failed' unless $?.exitstatus == 0
-
-            do_trigger = true
-
-            node["crowbar"]["disks"][disk]["usage"] = "ceph-osd"
-            node.save
-          end
-        end
-
-        if do_trigger
-          system 'udevadm', \
-            "trigger", \
-            "--subsystem-match=block", \
-            "--action=add"
-          raise 'udevadm trigger failed' unless $?.exitstatus == 0
-        end
-
-      end
-    end
-  end
-end
index acad61b8db996fdefc7d13fb50d98e04704ba856..636dddc7448f0a1e682e0f78ba73ca0502d09c12 100644 (file)
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-                       
+
+# this recipe allows bootstrapping new osds, with help from mon
+
 include_recipe "ceph::default"
+include_recipe "ceph::conf"
+
+package 'gdisk' do
+  action :upgrade
+end
+
+mons = get_mon_nodes("ceph_bootstrap_osd_key:*")
+
+if mons.empty? then
+  puts "No ceph-mon found."
+else
+
+  directory "/var/lib/ceph/bootstrap-osd" do
+    owner "root"
+    group "root"
+    mode "0755"
+  end
+
+  # TODO cluster name
+  cluster = 'ceph'
+
+  file "/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw" do
+    owner "root"
+    group "root"
+    mode "0440"
+    content mons[0]["ceph_bootstrap_osd_key"]
+  end
+
+  execute "format as keyring" do
+    command <<-EOH
+      set -e
+      # TODO don't put the key in "ps" output, stdout
+      read KEY <'/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
+      ceph-authtool '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring' --create-keyring --name=client.bootstrap-osd --add-key="$KEY"
+      rm -f '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw'
+    EOH
+  end
+
+  if is_crowbar?
+    ruby_block "select new disks for ceph osd" do
+      block do
+        do_trigger = false
+        node["crowbar"]["disks"].each do |disk, data|
+          use = true
+
+          if node["swift"] and node["swift"]["devs"]
+            node["swift"]["devs"].each do |num|
+              if num["name"].match(disk)
+                puts "Disk: #{disk} is being used for swift, skipping"
+                use = false
+              end
+            end
+          end
+
+          if node["crowbar"]["disks"][disk]["usage"] == "Storage" and use == true
+            puts "Disk: #{disk} should be used for ceph"
+
+            system 'ceph-disk-prepare', \
+              "/dev/#{disk}"
+            raise 'ceph-disk-prepare failed' unless $?.exitstatus == 0
+
+            do_trigger = true
+
+            node["crowbar"]["disks"][disk]["usage"] = "ceph-osd"
+            node.save
+          end
+        end
+
+        if do_trigger
+          system 'udevadm', \
+            "trigger", \
+            "--subsystem-match=block", \
+            "--action=add"
+          raise 'udevadm trigger failed' unless $?.exitstatus == 0
+        end
+
+      end
+    end
+  end
+end
index edf4088e1827c93eee5d185c3a16a07f13337dd1..25369e9f16c4a801c6d75d75a037791d7c1c3681 100644 (file)
@@ -1,5 +1,5 @@
 name "ceph-osd"
 description "Ceph Object Storage Device"
 run_list(
-        'recipe[ceph::bootstrap_osd]'
+        'recipe[ceph::osd]'
 )