added ec2 tags_none grouping for hosts without tags

This commit is contained in:
Chris Meyers 2015-01-16 10:06:43 -05:00
parent 4dff25884f
commit a6fdd9534e
2 changed files with 6 additions and 0 deletions

View File

@ -922,6 +922,7 @@ class InventorySourceOptions(BaseModel):
('security_group', 'Security Group'),
('tag_keys', 'Tags'),
('vpc_id', 'VPC ID'),
('tag_none', 'Tag None'),
]
@classmethod

View File

@ -264,6 +264,7 @@ class Ec2Inventory(object):
'group_by_vpc_id',
'group_by_security_group',
'group_by_tag_keys',
'group_by_tag_none',
'group_by_route53_names',
'group_by_rds_engine',
'group_by_rds_parameter_group',
@ -508,6 +509,10 @@ class Ec2Inventory(object):
if self.nested_groups:
self.push_group(self.inventory, 'route53', name)
# Global Tag: instances without tags
if self.group_by_tag_none and len(instance.tags) == 0:
self.push(self.inventory, 'tag_none', dest)
# Global Tag: tag all EC2 instances
self.push(self.inventory, 'ec2', dest)