From 17e8500202b0ef58ab2ac41521006b201cfbf094 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 24 Mar 2016 16:43:03 -0700 Subject: [PATCH] Don't process the same host multiple times Fixes #14259 --- lib/ansible/inventory/dir.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/inventory/dir.py b/lib/ansible/inventory/dir.py index e716987fd5f..bb077e036b3 100644 --- a/lib/ansible/inventory/dir.py +++ b/lib/ansible/inventory/dir.py @@ -159,7 +159,7 @@ class InventoryDirectory(object): if 'ungrouped' in self.groups: ungrouped = self.groups['ungrouped'] # loop on a copy of ungrouped hosts, as we want to change that list - for host in ungrouped.hosts[:]: + for host in frozenset(ungrouped.hosts): if len(host.groups) > 1: host.groups.remove(ungrouped) ungrouped.hosts.remove(host)