Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
069ee116
Commit
069ee116
authored
Jun 14, 2015
by
Victor Schröder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates add_elasticache_replication_group method in ec2.py dynamic inventory script
parent
c18f6cae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
plugins/inventory/ec2.py
+52
-0
No files found.
plugins/inventory/ec2.py
View file @
069ee116
...
...
@@ -926,6 +926,58 @@ class Ec2Inventory(object):
else
:
self
.
inventory
[
"_meta"
][
"hostvars"
][
dest
]
=
host_info
def
add_elasticache_replication_group
(
self
,
replication_group
,
region
):
''' Adds an ElastiCache replication group to the inventory and index '''
# Only want available clusters unless all_elasticache_replication_groups is True
if
not
self
.
all_elasticache_replication_groups
and
replication_group
[
'Status'
]
!=
'available'
:
return
# Select the best destination address (PrimaryEndpoint)
dest
=
replication_group
[
'NodeGroups'
][
0
][
'PrimaryEndpoint'
][
'Address'
]
if
not
dest
:
# Skip clusters we cannot address (e.g. private VPC subnet)
return
# Add to index
self
.
index
[
dest
]
=
[
region
,
replication_group
[
'ReplicationGroupId'
]]
# Inventory: Group by ID (always a group of 1)
if
self
.
group_by_instance_id
:
self
.
inventory
[
replication_group
[
'ReplicationGroupId'
]]
=
[
dest
]
if
self
.
nested_groups
:
self
.
push_group
(
self
.
inventory
,
'instances'
,
replication_group
[
'ReplicationGroupId'
])
# Inventory: Group by region
if
self
.
group_by_region
:
self
.
push
(
self
.
inventory
,
region
,
dest
)
if
self
.
nested_groups
:
self
.
push_group
(
self
.
inventory
,
'regions'
,
region
)
# Inventory: Group by availability zone (doesn't apply to replication groups)
# Inventory: Group by node type (doesn't apply to replication groups)
# Inventory: Group by VPC (information not available in the current
# AWS API version for replication groups
# Inventory: Group by security group (doesn't apply to replication groups)
# Check this value in cluster level
# Inventory: Group by engine (replication groups are always Redis)
if
self
.
group_by_elasticache_engine
:
self
.
push
(
self
.
inventory
,
'elasticache_redis'
,
dest
)
if
self
.
nested_groups
:
self
.
push_group
(
self
.
inventory
,
'elasticache_engines'
,
'redis'
)
# Global Tag: all ElastiCache clusters
self
.
push
(
self
.
inventory
,
'elasticache_replication_groups'
,
replication_group
[
'ReplicationGroupId'
])
host_info
=
self
.
get_host_info_dict_from_describe_dict
(
replication_group
)
self
.
inventory
[
"_meta"
][
"hostvars"
][
dest
]
=
host_info
def
get_route53_records
(
self
):
''' Get and store the map of resource records to domain names that
point to them. '''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment