diff --git a/library/system/authorized_key b/library/system/authorized_key
index ee613a90422..c9b178c3742 100644
--- a/library/system/authorized_key
+++ b/library/system/authorized_key
@@ -341,7 +341,9 @@ def enforce_state(module, params):
     state       = params.get("state", "present")
     key_options = params.get("key_options", None)
 
-    key = key.split('\n')
+    # extract indivial keys into an array, skipping blank lines and comments
+    key = [s for s in key.splitlines() if s and not s.startswith('#')]
+
 
     # check current state -- just get the filename, don't create file
     do_write = False