mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
adding regions_exclude parameter to be able to do subtractive region exclusion. Defaults to us-gov-west-1 so as to not cause errors for people who don't have govcloud credentials but get it in their regions list
This commit is contained in:
@@ -189,12 +189,14 @@ class Ec2Inventory(object):
|
||||
# Regions
|
||||
self.regions = []
|
||||
configRegions = config.get('ec2', 'regions')
|
||||
configRegions_exclude = config.get('ec2', 'regions_exclude')
|
||||
if (configRegions == 'all'):
|
||||
if self.eucalyptus_host:
|
||||
self.regions.append(boto.connect_euca(host=self.eucalyptus_host).region.name)
|
||||
else:
|
||||
for regionInfo in ec2.regions():
|
||||
self.regions.append(regionInfo.name)
|
||||
if regionInfo.name not in configRegions_exclude:
|
||||
self.regions.append(regionInfo.name)
|
||||
else:
|
||||
self.regions = configRegions.split(",")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user