1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

EC2 inventory toggle to exclude/include RDS instances.

This commit is contained in:
Ingmar Hupp 2014-03-27 15:57:24 +00:00
parent 1faa840b67
commit 456d2627e8
2 changed files with 8 additions and 1 deletions

View file

@ -38,6 +38,9 @@ vpc_destination_variable = ip_address
# Route53, uncomment and set 'route53' to True.
route53 = False
# To include RDS instances in inventory, set to True.
rds = False
# Additionally, you can specify the list of zones to exclude looking up in
# 'route53_excluded_zones' as a comma-separated list.
# route53_excluded_zones = samplezone1.com, samplezone2.com

View file

@ -222,6 +222,9 @@ class Ec2Inventory(object):
self.route53_excluded_zones.extend(
config.get('ec2', 'route53_excluded_zones', '').split(','))
# RDS
self.rds_enabled = config.getboolean('ec2', 'rds')
# Cache related
cache_dir = os.path.expanduser(config.get('ec2', 'cache_path'))
if not os.path.exists(cache_dir):
@ -254,7 +257,8 @@ class Ec2Inventory(object):
for region in self.regions:
self.get_instances_by_region(region)
self.get_rds_instances_by_region(region)
if self.rds_enabled:
self.get_rds_instances_by_region(region)
self.write_to_cache(self.inventory, self.cache_path_cache)
self.write_to_cache(self.index, self.cache_path_index)