Merge pull request #3981 from jerm/devel
Adding regions_exclude parameter to be able to do subtractive region exc...
This commit is contained in:
commit
6f76ccf10e
2 changed files with 4 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
# in AWS and merge the results together. Alternatively, set this to a comma
|
# in AWS and merge the results together. Alternatively, set this to a comma
|
||||||
# separated list of regions. E.g. 'us-east-1,us-west-1,us-west-2'
|
# separated list of regions. E.g. 'us-east-1,us-west-1,us-west-2'
|
||||||
regions = all
|
regions = all
|
||||||
|
regions_exclude = us-gov-west-1
|
||||||
|
|
||||||
# When generating inventory, Ansible needs to know how to address a server.
|
# When generating inventory, Ansible needs to know how to address a server.
|
||||||
# Each EC2 instance has a lot of variables associated with it. Here is the list:
|
# Each EC2 instance has a lot of variables associated with it. Here is the list:
|
||||||
|
|
|
@ -189,12 +189,14 @@ class Ec2Inventory(object):
|
||||||
# Regions
|
# Regions
|
||||||
self.regions = []
|
self.regions = []
|
||||||
configRegions = config.get('ec2', 'regions')
|
configRegions = config.get('ec2', 'regions')
|
||||||
|
configRegions_exclude = config.get('ec2', 'regions_exclude')
|
||||||
if (configRegions == 'all'):
|
if (configRegions == 'all'):
|
||||||
if self.eucalyptus_host:
|
if self.eucalyptus_host:
|
||||||
self.regions.append(boto.connect_euca(host=self.eucalyptus_host).region.name)
|
self.regions.append(boto.connect_euca(host=self.eucalyptus_host).region.name)
|
||||||
else:
|
else:
|
||||||
for regionInfo in ec2.regions():
|
for regionInfo in ec2.regions():
|
||||||
self.regions.append(regionInfo.name)
|
if regionInfo.name not in configRegions_exclude:
|
||||||
|
self.regions.append(regionInfo.name)
|
||||||
else:
|
else:
|
||||||
self.regions = configRegions.split(",")
|
self.regions = configRegions.split(",")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue