diff --git a/lib/ansible/inventory/data.py b/lib/ansible/inventory/data.py
index 43a044e4e8a..b928a587780 100644
--- a/lib/ansible/inventory/data.py
+++ b/lib/ansible/inventory/data.py
@@ -133,6 +133,10 @@ class InventoryData(object):
             group = self.groups[g]
             group_names.add(group.name)
 
+            # ensure all groups inherit from 'all'
+            if group.name != 'all' and not group.get_ancestors():
+                self.add_child('all', group.name)
+
         host_names = set()
         # get host vars from host_vars/ files and vars plugins
         for host in self.hosts.values():