mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-30 06:11:26 -07:00
Allow ec2 tags to be used to address servers in ec2 dynamic inventory.
This commit is contained in:
parent
bfe08560ec
commit
28e69b9017
2 changed files with 11 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue