mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Process information about replica clusters for ElastiCache replication groups
This commit is contained in:
@@ -1096,11 +1096,17 @@ class Ec2Inventory(object):
|
|||||||
if key == 'ec2_node_groups' and value:
|
if key == 'ec2_node_groups' and value:
|
||||||
host_info['ec2_endpoint_address'] = value[0]['PrimaryEndpoint']['Address']
|
host_info['ec2_endpoint_address'] = value[0]['PrimaryEndpoint']['Address']
|
||||||
host_info['ec2_endpoint_port'] = value[0]['PrimaryEndpoint']['Port']
|
host_info['ec2_endpoint_port'] = value[0]['PrimaryEndpoint']['Port']
|
||||||
|
replica_count = 0
|
||||||
for node in value[0]['NodeGroupMembers']:
|
for node in value[0]['NodeGroupMembers']:
|
||||||
if node['CurrentRole'] == 'primary':
|
if node['CurrentRole'] == 'primary':
|
||||||
host_info['ec2_primary_cluster_address'] = node['ReadEndpoint']['Address']
|
host_info['ec2_primary_cluster_address'] = node['ReadEndpoint']['Address']
|
||||||
host_info['ec2_primary_cluster_port'] = node['ReadEndpoint']['Port']
|
host_info['ec2_primary_cluster_port'] = node['ReadEndpoint']['Port']
|
||||||
host_info['ec2_primary_cluster_id'] = node['CacheClusterId']
|
host_info['ec2_primary_cluster_id'] = node['CacheClusterId']
|
||||||
|
elif node['CurrentRole'] == 'replica':
|
||||||
|
host_info['ec2_replica_cluster_address_'+ str(replica_count)] = node['ReadEndpoint']['Address']
|
||||||
|
host_info['ec2_replica_cluster_port_'+ str(replica_count)] = node['ReadEndpoint']['Port']
|
||||||
|
host_info['ec2_replica_cluster_id_'+ str(replica_count)] = node['CacheClusterId']
|
||||||
|
replica_count += 1
|
||||||
if key == 'ec2_member_clusters' and value:
|
if key == 'ec2_member_clusters' and value:
|
||||||
host_info['ec2_member_clusters'] = ','.join([str(i) for i in value])
|
host_info['ec2_member_clusters'] = ','.join([str(i) for i in value])
|
||||||
elif key == 'ec2_cache_parameter_group':
|
elif key == 'ec2_cache_parameter_group':
|
||||||
|
|||||||
Reference in New Issue
Block a user