From 1cf07028d400cd3cef5699c37cadfefb7bbb9532 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Wed, 9 May 2018 14:13:48 -0500 Subject: [PATCH] Don't display host pattern warning for empty groups (fixes #35255) (#39927) --- lib/ansible/inventory/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index 74bec74e67..0772cff636 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -544,8 +544,10 @@ class InventoryManager(object): if implicit: results.append(implicit) - if not results and pattern != 'all': + # Display warning if specified host pattern did not match any groups or hosts + if not results and not matching_groups and pattern != 'all': display.warning("Could not match supplied host pattern, ignoring: %s" % pattern) + return results def list_hosts(self, pattern="all"):