|
|
@ -19,7 +19,7 @@ DOCUMENTATION = '''
|
|
|
|
module: ec2
|
|
|
|
module: ec2
|
|
|
|
short_description: create an instance in ec2, return instanceid
|
|
|
|
short_description: create an instance in ec2, return instanceid
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- creates ec2 instances and optionally waits for it to be 'running'. This module has a dependency on the external I(euca2ools) package.
|
|
|
|
- creates ec2 instances and optionally waits for it to be 'running'. This module has a dependency on boto and m2crypt.
|
|
|
|
version_added: "0.9"
|
|
|
|
version_added: "0.9"
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
key_name:
|
|
|
|
key_name:
|
|
|
@ -66,7 +66,7 @@ options:
|
|
|
|
aliases: []
|
|
|
|
aliases: []
|
|
|
|
ec2_url:
|
|
|
|
ec2_url:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- url to use to connect to ec2 or your Eucalyptus cloud (for example (https://ec2.amazonaws.com) when using Amazon ec2 directly and not Eucalyptus)
|
|
|
|
- url to use to connect to ec2 or your Eucalyptus cloud (by default the module will use ec2 endpoints)
|
|
|
|
required: False
|
|
|
|
required: False
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
aliases: []
|
|
|
|
aliases: []
|
|
|
@ -88,6 +88,12 @@ options:
|
|
|
|
required: False
|
|
|
|
required: False
|
|
|
|
default: 1
|
|
|
|
default: 1
|
|
|
|
aliases: []
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
monitor:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- enable detailed monitoring (CloudWatch) for instance
|
|
|
|
|
|
|
|
required: False
|
|
|
|
|
|
|
|
default: null
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
user_data:
|
|
|
|
user_data:
|
|
|
|
version_added: "0.9"
|
|
|
|
version_added: "0.9"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -120,6 +126,7 @@ def main():
|
|
|
|
image = dict(required=True),
|
|
|
|
image = dict(required=True),
|
|
|
|
kernel = dict(),
|
|
|
|
kernel = dict(),
|
|
|
|
count = dict(default='1'),
|
|
|
|
count = dict(default='1'),
|
|
|
|
|
|
|
|
monitoring = dict(choices=BOOLEANS, default=False),
|
|
|
|
ramdisk = dict(),
|
|
|
|
ramdisk = dict(),
|
|
|
|
wait = dict(choices=BOOLEANS, default=False),
|
|
|
|
wait = dict(choices=BOOLEANS, default=False),
|
|
|
|
ec2_url = dict(aliases=['EC2_URL']),
|
|
|
|
ec2_url = dict(aliases=['EC2_URL']),
|
|
|
@ -134,6 +141,7 @@ def main():
|
|
|
|
instance_type = module.params.get('instance_type')
|
|
|
|
instance_type = module.params.get('instance_type')
|
|
|
|
image = module.params.get('image')
|
|
|
|
image = module.params.get('image')
|
|
|
|
count = module.params.get('count')
|
|
|
|
count = module.params.get('count')
|
|
|
|
|
|
|
|
monitoring = module.params.get('monitoring')
|
|
|
|
kernel = module.params.get('kernel')
|
|
|
|
kernel = module.params.get('kernel')
|
|
|
|
ramdisk = module.params.get('ramdisk')
|
|
|
|
ramdisk = module.params.get('ramdisk')
|
|
|
|
wait = module.params.get('wait')
|
|
|
|
wait = module.params.get('wait')
|
|
|
@ -159,7 +167,9 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
res = ec2.run_instances(image, key_name = key_name,
|
|
|
|
res = ec2.run_instances(image, key_name = key_name,
|
|
|
|
min_count = count, max_count = count,
|
|
|
|
min_count = count,
|
|
|
|
|
|
|
|
max_count = count,
|
|
|
|
|
|
|
|
monitoring_enabled = monitoring,
|
|
|
|
security_groups = [group],
|
|
|
|
security_groups = [group],
|
|
|
|
instance_type = instance_type,
|
|
|
|
instance_type = instance_type,
|
|
|
|
kernel_id = kernel,
|
|
|
|
kernel_id = kernel,
|
|
|
|