1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add grouping by hostname for the Packet inventory (#21069)

* Add grouping by hostname for the Packet inventory

* remove space after eol
This commit is contained in:
Tomáš Karásek 2017-07-18 16:31:42 +03:00 committed by Brian Coca
parent 33ac35c68d
commit a5c41dcd49
2 changed files with 8 additions and 0 deletions

View file

@ -37,6 +37,7 @@ replace_dash_in_groups = True
# The packet inventory output can become very large. To manage its size,
# configure which groups should be created.
group_by_device_id = True
group_by_hostname = True
group_by_facility = True
group_by_project = True
group_by_operating_system = True

View file

@ -175,6 +175,7 @@ class PacketInventory(object):
# Configure which groups should be created.
group_by_options = [
'group_by_device_id',
'group_by_hostname',
'group_by_facility',
'group_by_project',
'group_by_operating_system',
@ -327,6 +328,12 @@ class PacketInventory(object):
if self.nested_groups:
self.push_group(self.inventory, 'devices', device.id)
# Inventory: Group by device name (hopefully a group of 1)
if self.group_by_hostname:
self.push(self.inventory, device.hostname, dest)
if self.nested_groups:
self.push_group(self.inventory, 'hostnames', project.name)
# Inventory: Group by project
if self.group_by_project:
self.push(self.inventory, project.name, dest)