diff --git a/src/hostinfo.py b/src/hostinfo.py
index 10c84f4fc94852ba21151e14bb1ad57e4f3abd89..33c0895343a5d157587fcc2a84f5215777f0467b 100755
--- a/src/hostinfo.py
+++ b/src/hostinfo.py
@@ -275,6 +275,7 @@ if __name__ == '__main__':
         hostinfo.dhcpd.generate(tree, options)
         hostinfo.dhcpd_ipv6.generate(tree, options)
         hostinfo.automount.generate(tree, None)
+        hostinfo.role.generate(tree, None, None)
         sys.exit(0)
 
     if options.dfs:
diff --git a/src/hostinfo/role.py b/src/hostinfo/role.py
index 61bb5d7fcb7c02579715e05c85a9fa2105ca5d15..f8accda3b46a22cd6c04aa9879bdce02f2732b6e 100755
--- a/src/hostinfo/role.py
+++ b/src/hostinfo/role.py
@@ -2,6 +2,9 @@ import hostinfo.util as util
 
 def generate(tree, host, roles):
     by_role = get_all(tree)
+    if host == None and roles == None:
+        # Just doing sanity check of hostinfo.xml file
+        return None
     for r in roles:
         if not r in by_role:
             raise Exception("Role '%s' not found in %s" %