mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adds a flag (is_redis) to prevent duplicity of information about Redis single node clusters
This commit is contained in:
parent
2a242a0e1b
commit
e64daba8e7
1 changed files with 9 additions and 5 deletions
|
@ -702,9 +702,13 @@ class Ec2Inventory(object):
|
|||
if 'ConfigurationEndpoint' in cluster and cluster['ConfigurationEndpoint']:
|
||||
# Memcached cluster
|
||||
dest = cluster['ConfigurationEndpoint']['Address']
|
||||
is_redis = False
|
||||
else:
|
||||
# Redis sigle node cluster
|
||||
# Because all Redis clusters are single nodes, we'll merge the
|
||||
# info from the cluster with info about the node
|
||||
dest = cluster['CacheNodes'][0]['Endpoint']['Address']
|
||||
is_redis = True
|
||||
|
||||
if not dest:
|
||||
# Skip clusters we cannot address (e.g. private VPC subnet)
|
||||
|
@ -720,13 +724,13 @@ class Ec2Inventory(object):
|
|||
self.push_group(self.inventory, 'instances', cluster['CacheClusterId'])
|
||||
|
||||
# Inventory: Group by region
|
||||
if self.group_by_region:
|
||||
if self.group_by_region and not is_redis:
|
||||
self.push(self.inventory, region, dest)
|
||||
if self.nested_groups:
|
||||
self.push_group(self.inventory, 'regions', region)
|
||||
|
||||
# Inventory: Group by availability zone
|
||||
if self.group_by_availability_zone:
|
||||
if self.group_by_availability_zone and not is_redis:
|
||||
self.push(self.inventory, cluster['PreferredAvailabilityZone'], dest)
|
||||
if self.nested_groups:
|
||||
if self.group_by_region:
|
||||
|
@ -734,7 +738,7 @@ class Ec2Inventory(object):
|
|||
self.push_group(self.inventory, 'zones', cluster['PreferredAvailabilityZone'])
|
||||
|
||||
# Inventory: Group by node type
|
||||
if self.group_by_instance_type:
|
||||
if self.group_by_instance_type and not is_redis:
|
||||
type_name = self.to_safe('type_' + cluster['CacheNodeType'])
|
||||
self.push(self.inventory, type_name, dest)
|
||||
if self.nested_groups:
|
||||
|
@ -748,7 +752,7 @@ class Ec2Inventory(object):
|
|||
# self.push_group(self.inventory, 'vpcs', vpc_id_name)
|
||||
|
||||
# Inventory: Group by security group
|
||||
if self.group_by_security_group:
|
||||
if self.group_by_security_group and not is_redis:
|
||||
if 'SecurityGroups' in cluster:
|
||||
for security_group in cluster['SecurityGroups']:
|
||||
key = self.to_safe("security_group_" + security_group['SecurityGroupId'])
|
||||
|
@ -757,7 +761,7 @@ class Ec2Inventory(object):
|
|||
self.push_group(self.inventory, 'security_groups', key)
|
||||
|
||||
# Inventory: Group by engine
|
||||
if self.group_by_elasticache_engine:
|
||||
if self.group_by_elasticache_engine and not is_redis:
|
||||
self.push(self.inventory, self.to_safe("elasticache_" + cluster['Engine']), dest)
|
||||
if self.nested_groups:
|
||||
self.push_group(self.inventory, 'elasticache_engines', self.to_safe(cluster['Engine']))
|
||||
|
|
Loading…
Reference in a new issue