mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
YAML inventory unit test: fix test inventory format (#33828)
* Fix YAML inventory unit test * YAML inventory unit test: add checks * YAML: add hosts without any group to ungrouped
This commit is contained in:
@@ -140,6 +140,9 @@ class InventoryModule(BaseFileInventoryPlugin):
|
||||
for host_pattern in group_data['hosts']:
|
||||
hosts, port = self._parse_host(host_pattern)
|
||||
self._populate_host_vars(hosts, group_data['hosts'][host_pattern] or {}, group, port)
|
||||
if group == 'all':
|
||||
for host in hosts:
|
||||
self.inventory.add_host(host, group='ungrouped', port=port)
|
||||
else:
|
||||
self.display.warning('Skipping unexpected key (%s) in group (%s), only "vars", "children" and "hosts" are valid' % (key, group))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user