|
|
@ -77,6 +77,11 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
aliases: ['aws_zone', 'ec2_zone']
|
|
|
|
aliases: ['aws_zone', 'ec2_zone']
|
|
|
|
|
|
|
|
snapshot:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- snapshot ID on which to base the volume
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: null
|
|
|
|
requirements: [ "boto" ]
|
|
|
|
requirements: [ "boto" ]
|
|
|
|
author: Lester Wade
|
|
|
|
author: Lester Wade
|
|
|
|
'''
|
|
|
|
'''
|
|
|
@ -139,6 +144,7 @@ def main():
|
|
|
|
ec2_url = dict(),
|
|
|
|
ec2_url = dict(),
|
|
|
|
ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True),
|
|
|
|
ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True),
|
|
|
|
ec2_access_key = dict(aliases=['aws_access_key', 'access_key']),
|
|
|
|
ec2_access_key = dict(aliases=['aws_access_key', 'access_key']),
|
|
|
|
|
|
|
|
snapshot = dict(),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -147,6 +153,7 @@ def main():
|
|
|
|
iops = module.params.get('iops')
|
|
|
|
iops = module.params.get('iops')
|
|
|
|
device_name = module.params.get('device_name')
|
|
|
|
device_name = module.params.get('device_name')
|
|
|
|
zone = module.params.get('zone')
|
|
|
|
zone = module.params.get('zone')
|
|
|
|
|
|
|
|
snapshot = module.params.get('snapshot')
|
|
|
|
|
|
|
|
|
|
|
|
ec2 = ec2_connect(module)
|
|
|
|
ec2 = ec2_connect(module)
|
|
|
|
|
|
|
|
|
|
|
@ -178,7 +185,7 @@ def main():
|
|
|
|
# If no instance supplied, try volume creation based on module parameters.
|
|
|
|
# If no instance supplied, try volume creation based on module parameters.
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
volume = ec2.create_volume(volume_size, zone, None, volume_type, iops)
|
|
|
|
volume = ec2.create_volume(volume_size, zone, snapshot, volume_type, iops)
|
|
|
|
while volume.status != 'available':
|
|
|
|
while volume.status != 'available':
|
|
|
|
time.sleep(3)
|
|
|
|
time.sleep(3)
|
|
|
|
volume.update()
|
|
|
|
volume.update()
|
|
|
|