mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 14:29:10 -07:00
Merge pull request #9825 from kalefranz/ec2-inventory-tags
Allow ec2 tags to be used to address servers in ec2 dynamic inventory.
This commit is contained in:
commit
5eafa1e7c3
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