diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index e52bbc10a3..26525bc6a5 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -922,6 +922,7 @@ class InventorySourceOptions(BaseModel): ('security_group', 'Security Group'), ('tag_keys', 'Tags'), ('vpc_id', 'VPC ID'), + ('tag_none', 'Tag None'), ] @classmethod diff --git a/awx/plugins/inventory/ec2.py b/awx/plugins/inventory/ec2.py index 7bb1ad1708..5ad7bb4cd7 100755 --- a/awx/plugins/inventory/ec2.py +++ b/awx/plugins/inventory/ec2.py @@ -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)