|
|
|
@ -170,6 +170,7 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
|
|
|
|
|
promise['requestId']
|
|
|
|
|
) + '" to complete.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _create_volume(module, profitbricks, datacenter, name):
|
|
|
|
|
size = module.params.get('size')
|
|
|
|
|
bus = module.params.get('bus')
|
|
|
|
@ -204,12 +205,14 @@ def _create_volume(module, profitbricks, datacenter, name):
|
|
|
|
|
|
|
|
|
|
return volume_response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _delete_volume(module, profitbricks, datacenter, volume):
|
|
|
|
|
try:
|
|
|
|
|
profitbricks.delete_volume(datacenter, volume)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
module.fail_json(msg="failed to remove the volume: %s" % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_volume(module, profitbricks):
|
|
|
|
|
"""
|
|
|
|
|
Creates a volume.
|
|
|
|
@ -282,6 +285,7 @@ def create_volume(module, profitbricks):
|
|
|
|
|
|
|
|
|
|
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_volume(module, profitbricks):
|
|
|
|
|
"""
|
|
|
|
|
Removes a volume.
|
|
|
|
@ -324,6 +328,7 @@ def delete_volume(module, profitbricks):
|
|
|
|
|
|
|
|
|
|
return changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _attach_volume(module, profitbricks, datacenter, volume):
|
|
|
|
|
"""
|
|
|
|
|
Attaches a volume.
|
|
|
|
@ -352,18 +357,19 @@ def _attach_volume(module, profitbricks, datacenter, volume):
|
|
|
|
|
except Exception as e:
|
|
|
|
|
module.fail_json(msg='failed to attach volume: %s' % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
module = AnsibleModule(
|
|
|
|
|
argument_spec=dict(
|
|
|
|
|
datacenter=dict(),
|
|
|
|
|
server=dict(),
|
|
|
|
|
name=dict(),
|
|
|
|
|
size=dict(default=10),
|
|
|
|
|
size=dict(type='int', default=10),
|
|
|
|
|
bus=dict(default='VIRTIO'),
|
|
|
|
|
image=dict(),
|
|
|
|
|
image_password=dict(default=None),
|
|
|
|
|
ssh_keys=dict(type='list', default=[]),
|
|
|
|
|
disk_type=dict(default='HDD'),
|
|
|
|
|
disk_type=dict(choices=['HDD', 'SSD'], default='HDD'),
|
|
|
|
|
licence_type=dict(default='UNKNOWN'),
|
|
|
|
|
count=dict(type='int', default=1),
|
|
|
|
|
auto_increment=dict(type='bool', default=True),
|
|
|
|
|