diff --git a/lib/ansible/inventory/dir.py b/lib/ansible/inventory/dir.py index 53a6349fc7..e3eda22695 100644 --- a/lib/ansible/inventory/dir.py +++ b/lib/ansible/inventory/dir.py @@ -36,13 +36,12 @@ class InventoryDirectory(object): self.parsers = [] self.hosts = {} self.groups = {} - + for i in self.names: # Skip files that end with certain extensions or characters - for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo"): - if i.endswith(ext): - continue + if any(i.endswith(ext) for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo")): + continue # Skip hidden files if i.startswith('.') and not i.startswith('./'): continue