diff --git a/lib/puppet/functions/krb5conf/realms.rb b/lib/puppet/functions/krb5conf/realms.rb
index 5a6223ea5eafe84506c046cad8a0edf45a89d01c..a09d7aeb93a45dc25257245d4dc7ddd0145f20aa 100644
--- a/lib/puppet/functions/krb5conf/realms.rb
+++ b/lib/puppet/functions/krb5conf/realms.rb
@@ -1,5 +1,8 @@
 Puppet::Functions.create_function(:'krb5conf::realms') do
   def realms(realms_hash)
+    indent = 4
+    spacer = ' ' * indent
+
     final_string = ""
     list_of_realms = realms_hash.keys()
     list_of_realms.each do |r|
@@ -8,9 +11,9 @@ Puppet::Functions.create_function(:'krb5conf::realms') do
       lengths    = attributes.map { |x| x[0].length() }
       max_length = lengths.max
       attributes.each do |attribute|
-        rv.push(sprintf("    %-#{max_length}s = %s", attribute[0], attribute[1]))
+        rv.push(sprintf("#{spacer}%-#{max_length}s = %s", attribute[0], attribute[1]))
       end
-      final_string += "  #{r} = {\n" + rv.join("\n") + "\n  }\n"
+      final_string += "#{spacer}#{r} = {\n" + rv.join("\n") + "\n  }\n"
     end
     return "[realms]\n#{final_string}"
   end
diff --git a/lib/puppet/functions/krb5conf/simple_hash_section.rb b/lib/puppet/functions/krb5conf/simple_hash_section.rb
index 839277d2d888476f470c67fa8f9e28b7c01cd5f7..9cf0f3b04dd76d90009d6d3b62a9764b11c2f6da 100644
--- a/lib/puppet/functions/krb5conf/simple_hash_section.rb
+++ b/lib/puppet/functions/krb5conf/simple_hash_section.rb
@@ -1,15 +1,18 @@
 Puppet::Functions.create_function(:'krb5conf::simple_hash_section') do
   def simple_hash_section(hash, title)
+    indent = 4
+    spacer = ' ' * indent
+
     lengths = hash.keys().map { |x| x.length() }
     max_length = lengths.max
     rv = []
     hash.each do |key, value|
       if (key == 'COMMENT') then
         # Add a '#' mark at the start of each line.
-        formatted_lines = value.split("\n").map { |l| '  # ' + l }
+        formatted_lines = value.split("\n").map { |l| spacer + '# ' + l }
         rv.push(formatted_lines)
       else
-        rv.push(sprintf("  %-#{max_length}s = %s", key, value))
+        rv.push(sprintf("#{spacer}%-#{max_length}s = %s", key, value))
       end
     end
     return "[#{title}]\n" + rv.join("\n") + "\n"