mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
Updated inventory plugins from ansible, updated all third party packages in awx/lib/site-packages to latest versions, minor serializer fixes after package upgrades.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
# 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'
|
||||
regions = all
|
||||
regions_exclude = us-gov-west-1
|
||||
regions_exclude = us-gov-west-1,cn-north-1
|
||||
|
||||
# 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:
|
||||
@@ -39,7 +39,7 @@ vpc_destination_variable = ip_address
|
||||
route53 = False
|
||||
|
||||
# Additionally, you can specify the list of zones to exclude looking up in
|
||||
# 'route53_excluded_zones' as a comma-seperated list.
|
||||
# 'route53_excluded_zones' as a comma-separated list.
|
||||
# route53_excluded_zones = samplezone1.com, samplezone2.com
|
||||
|
||||
# API calls to EC2 are slow. For this reason, we cache the results of an API
|
||||
@@ -47,7 +47,7 @@ route53 = False
|
||||
# will be written to this directory:
|
||||
# - ansible-ec2.cache
|
||||
# - ansible-ec2.index
|
||||
cache_path = /tmp
|
||||
cache_path = ~/.ansible/tmp
|
||||
|
||||
# The number of seconds a cache file is considered valid. After this many
|
||||
# seconds, a new API call will be made, and the cache file will be updated.
|
||||
|
||||
@@ -223,9 +223,12 @@ class Ec2Inventory(object):
|
||||
config.get('ec2', 'route53_excluded_zones', '').split(','))
|
||||
|
||||
# Cache related
|
||||
cache_path = config.get('ec2', 'cache_path')
|
||||
self.cache_path_cache = cache_path + "/ansible-ec2.cache"
|
||||
self.cache_path_index = cache_path + "/ansible-ec2.index"
|
||||
cache_dir = os.path.expanduser(config.get('ec2', 'cache_path'))
|
||||
if not os.path.exists(cache_dir):
|
||||
os.makedirs(cache_dir)
|
||||
|
||||
self.cache_path_cache = cache_dir + "/ansible-ec2.cache"
|
||||
self.cache_path_index = cache_dir + "/ansible-ec2.index"
|
||||
self.cache_max_age = config.getint('ec2', 'cache_max_age')
|
||||
|
||||
|
||||
@@ -251,7 +254,7 @@ class Ec2Inventory(object):
|
||||
|
||||
for region in self.regions:
|
||||
self.get_instances_by_region(region)
|
||||
# Don't return RDS instances for AWX!
|
||||
# Don't return RDS instances for Ansible Tower!
|
||||
#self.get_rds_instances_by_region(region)
|
||||
|
||||
self.write_to_cache(self.inventory, self.cache_path_cache)
|
||||
@@ -279,7 +282,7 @@ class Ec2Inventory(object):
|
||||
for instance in reservation.instances:
|
||||
self.add_instance(instance, region)
|
||||
|
||||
except boto.exception.BotoServerError as e:
|
||||
except boto.exception.BotoServerError, e:
|
||||
if not self.eucalyptus:
|
||||
print "Looks like AWS is down again:"
|
||||
print e
|
||||
@@ -295,10 +298,11 @@ class Ec2Inventory(object):
|
||||
instances = conn.get_all_dbinstances()
|
||||
for instance in instances:
|
||||
self.add_rds_instance(instance, region)
|
||||
except boto.exception.BotoServerError as e:
|
||||
print "Looks like AWS RDS is down: "
|
||||
print e
|
||||
sys.exit(1)
|
||||
except boto.exception.BotoServerError, e:
|
||||
if not e.reason == "Forbidden":
|
||||
print "Looks like AWS RDS is down: "
|
||||
print e
|
||||
sys.exit(1)
|
||||
|
||||
def get_instance(self, region, instance_id):
|
||||
''' Gets details about a specific instance '''
|
||||
@@ -340,7 +344,7 @@ class Ec2Inventory(object):
|
||||
# Add to index
|
||||
self.index[dest] = [region, instance.id]
|
||||
|
||||
# Do not output group based on instance ID for AWX!
|
||||
# Do not output group based on instance ID for Ansible Tower!
|
||||
# Inventory: Group by instance ID (always a group of 1)
|
||||
#self.inventory[instance.id] = [dest]
|
||||
|
||||
@@ -508,6 +512,8 @@ class Ec2Inventory(object):
|
||||
instance_vars[key] = ''
|
||||
elif key == 'ec2_region':
|
||||
instance_vars[key] = value.name
|
||||
elif key == 'ec2__placement':
|
||||
instance_vars['ec2_placement'] = value.zone
|
||||
elif key == 'ec2_tags':
|
||||
for k, v in value.iteritems():
|
||||
key = self.to_safe('ec2_tag_' + k)
|
||||
|
||||
@@ -226,4 +226,4 @@ def main():
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
Reference in New Issue
Block a user