Merge branch 'drcapulet/ec2-sourcedestcheck' of https://github.com/drcapulet/ansible into drcapulet-drcapulet/ec2-sourcedestcheck

This commit is contained in:
James Cammarata 2014-03-11 10:56:44 -05:00
commit 0ddc094b8f

View file

@ -184,6 +184,12 @@ options:
required: false required: false
default: null default: null
aliases: [] aliases: []
source_dest_check:
version_added: "1.5"
description:
- Enable or Disable the Source/Destination checks (for NAT instances and Virtual Routers)
required: false
default: true
state: state:
version_added: "1.3" version_added: "1.3"
description: description:
@ -724,6 +730,7 @@ def create_instances(module, ec2, override_count=None):
volumes = module.params.get('volumes') volumes = module.params.get('volumes')
exact_count = module.params.get('exact_count') exact_count = module.params.get('exact_count')
count_tag = module.params.get('count_tag') count_tag = module.params.get('count_tag')
source_dest_check = module.boolean(module.params.get('source_dest_check'))
# group_id and group_name are exclusive of each other # group_id and group_name are exclusive of each other
if group_id and group_name: if group_id and group_name:
@ -876,6 +883,11 @@ def create_instances(module, ec2, override_count=None):
for inst in this_res.instances: for inst in this_res.instances:
running_instances.append(inst) running_instances.append(inst)
# Enabled by default by Amazon
if not source_dest_check:
for inst in res.instances:
inst.modify_attribute('sourceDestCheck', False)
instance_dict_array = [] instance_dict_array = []
created_instance_ids = [] created_instance_ids = []
for inst in running_instances: for inst in running_instances:
@ -1049,6 +1061,7 @@ def main():
private_ip = dict(), private_ip = dict(),
instance_profile_name = dict(), instance_profile_name = dict(),
instance_ids = dict(type='list'), instance_ids = dict(type='list'),
source_dest_check = dict(type='bool', default=True),
state = dict(default='present'), state = dict(default='present'),
exact_count = dict(type='int', default=None), exact_count = dict(type='int', default=None),
count_tag = dict(), count_tag = dict(),