def lookup_instance(self, name):
try:
ec2_conn = boto.ec2.connect_to_region(region_name=self.region, profile_name=self.profile)
except Exception as e:
raise AnsibleError(e)
filters = {self.filter: name}
reservations = ec2_conn.get_all_instances(filters={'tag:name': 'nat-main'})
instances = [i for r in reservations for i in r.instances]
for instance in instances:
if instance.state == 'terminated' or instance.state == 'stopped':
continue
return instance.id.encode('utf-8')
return name
ec2_vpc_route_table_helper.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录