]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Skip cephx if disabled
authorCraig Lewis <clewis@centraldesktop.com>
Wed, 4 Sep 2013 20:52:18 +0000 (13:52 -0700)
committerGuilhem Lettron <guilhem.lettron@optiflows.com>
Wed, 9 Apr 2014 08:32:09 +0000 (10:32 +0200)
fix #63

libraries/default.rb
recipes/mon.rb
recipes/osd.rb

index d02f7c4bd6f7f6d78b49bcba29716ac5b58dcdbb..c4ce83eceed08b45ac0a8f7848a540fc4f041554 100644 (file)
@@ -101,3 +101,15 @@ def quorum?
   state = JSON.parse(cmd.stdout)['state']
   QUORUM_STATES.include?(state)
 end
+
+# Cephx is on by default, but users can disable it.
+# type can be one of 3 values: cluster, service, or client.  If the value is none of the above, set it to cluster
+def use_cephx?(type = nil)
+  # Verify type is valid
+  type = 'cluster' if %w(cluster service client).index(type).nil?
+
+  # CephX is enabled if it's not configured at all, or explicity enabled
+  node['ceph']['config'].nil? ||
+    node['ceph']['config']['global'].nil? ||
+    node['ceph']['config']['global']["auth #{type} required"] == 'cephx'
+end
index d899107d2e03c9f96b0f1eabc49f8d35a48b29b1..489ddb37ec58740432b02d8ad2372a6456e04ea8 100644 (file)
@@ -99,10 +99,9 @@ mon_addresses.each do |addr|
   end
 end
 
-# The key is going to be automatically
-# created,
-# We store it when it is created
-unless node['ceph']['encrypted_data_bags']
+# The key is going to be automatically created, We store it when it is created
+# If we're storing keys in encrypted data bags, then they've already been generated above
+if use_cephx? && !node['ceph']['encrypted_data_bags']
   ruby_block 'get osd-bootstrap keyring' do
     block do
       run_out = ''
index 5c35bca641bd22b54b9f7c51eb4ae25d3b510bbd..a9f6f7d9d0738eae84933e5bbb0ea7b627a9b9b8 100644 (file)
@@ -44,7 +44,13 @@ package 'cryptsetup' do
 end
 
 service_type = node['ceph']['osd']['init_style']
-mons = node['ceph']['encrypted_data_bags'] ? get_mon_nodes : get_mon_nodes('ceph_bootstrap_osd_key:*')
+# Look for monitors with osd bootstrap keys.
+# If we're storing keys in encrypted data bags, then we'll have to trust the roles
+if use_cephx? && !node['ceph']['encrypted_data_bags']
+  mons = get_mon_nodes('ceph_bootstrap_osd_key:*')
+else
+  mons = get_mon_nodes
+end
 
 return 'No ceph-mon found.' if mons.empty?