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
28e69b90
Commit
28e69b90
authored
Dec 15, 2014
by
Kale Franz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow ec2 tags to be used to address servers in ec2 dynamic inventory.
parent
bfe08560
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
plugins/inventory/ec2.ini
+5
-2
plugins/inventory/ec2.py
+6
-2
No files found.
plugins/inventory/ec2.ini
View file @
28e69b90
...
...
@@ -24,14 +24,17 @@ regions_exclude = us-gov-west-1,cn-north-1
# This is the normal destination variable to use. If you are running Ansible
# from outside EC2, then 'public_dns_name' makes the most sense. If you are
# running Ansible from within EC2, then perhaps you want to use the internal
# address, and should set this to 'private_dns_name'.
# address, and should set this to 'private_dns_name'. The key of an EC2 tag
# may optionally be used; however the boto instance variables hold precedence
# in the event of a collision.
destination_variable
=
public_dns_name
# For server inside a VPC, using DNS names may not make sense. When an instance
# has 'subnet_id' set, this variable is used. If the subnet is public, setting
# this to 'ip_address' will return the public IP address. For instances in a
# private subnet, this should be set to 'private_ip_address', and Ansible must
# be run from with EC2.
# be run from with EC2. The key of an EC2 tag may optionally be used; however
# the boto instance variables hold precedence in the event of a collision.
vpc_destination_variable
=
ip_address
# To tag instances on EC2 with the resource records that point to them from
...
...
plugins/inventory/ec2.py
View file @
28e69b90
...
...
@@ -385,9 +385,13 @@ class Ec2Inventory(object):
# Select the best destination address
if
instance
.
subnet_id
:
dest
=
getattr
(
instance
,
self
.
vpc_destination_variable
)
dest
=
getattr
(
instance
,
self
.
vpc_destination_variable
,
None
)
if
dest
is
None
:
dest
=
getattr
(
instance
,
'tags'
)
.
get
(
self
.
vpc_destination_variable
,
None
)
else
:
dest
=
getattr
(
instance
,
self
.
destination_variable
)
dest
=
getattr
(
instance
,
self
.
destination_variable
,
None
)
if
dest
is
None
:
dest
=
getattr
(
instance
,
'tags'
)
.
get
(
self
.
destination_variable
,
None
)
if
not
dest
:
# Skip instances we cannot address (e.g. private VPC subnet)
...
...
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