add support for disk_config option to cloud/rax module

This commit is contained in:
Constantine Peresypkin 2013-08-23 19:57:53 +03:00 committed by Michael DeHaan
parent 377b3f4b6f
commit c2eef4d139

View file

@ -73,6 +73,11 @@ options:
description: description:
- Region to create an instance in - Region to create an instance in
default: DFW default: DFW
disk_config:
description:
- Disk partitioning strategy
choices: ['auto', 'manual']
default: auto
wait: wait:
description: description:
- wait for the instance to be in state 'running' before returning - wait for the instance to be in state 'running' before returning
@ -130,7 +135,7 @@ except ImportError:
SUPPORTEDSERVICES = ['cloudservers'] SUPPORTEDSERVICES = ['cloudservers']
def cloudservers(module, state, name, flavor, image, meta, key_name, files, def cloudservers(module, state, name, flavor, image, meta, key_name, files,
wait, wait_timeout): wait, wait_timeout, disk_config):
# Check our args (this could be done better) # Check our args (this could be done better)
for arg in (state, name, flavor, image): for arg in (state, name, flavor, image):
if not arg: if not arg:
@ -169,7 +174,8 @@ def cloudservers(module, state, name, flavor, image, meta, key_name, files,
flavor=flavor, flavor=flavor,
key_name=key_name, key_name=key_name,
meta=meta, meta=meta,
files=files)] files=files,
disk_config=disk_config)]
changed = True changed = True
except Exception, e: except Exception, e:
module.fail_json(msg = '%s' % e.message) module.fail_json(msg = '%s' % e.message)
@ -243,6 +249,7 @@ def main():
name = dict(), name = dict(),
flavor = dict(), flavor = dict(),
image = dict(), image = dict(),
disk_config = dict(default='auto', choices=['auto', 'manual']),
meta = dict(type='dict', default={}), meta = dict(type='dict', default={}),
key_name = dict(aliases = ['keypair']), key_name = dict(aliases = ['keypair']),
files = dict(type='dict', default={}), files = dict(type='dict', default={}),
@ -266,6 +273,7 @@ def main():
region = module.params.get('region') region = module.params.get('region')
wait = module.params.get('wait') wait = module.params.get('wait')
wait_timeout = int(module.params.get('wait_timeout')) wait_timeout = int(module.params.get('wait_timeout'))
disk_config = module.params.get('disk_config').upper()
# Setup the credentials and region # Setup the credentials and region
try: try:
@ -294,7 +302,7 @@ def main():
# Act based on service # Act based on service
if service == 'cloudservers': if service == 'cloudservers':
cloudservers(module, state, name, flavor, image, meta, key_name, files, cloudservers(module, state, name, flavor, image, meta, key_name, files,
wait, wait_timeout) wait, wait_timeout, disk_config)
elif service in ['cloudfiles', 'cloud_blockstorage', elif service in ['cloudfiles', 'cloud_blockstorage',
'cloud_databases', 'cloud_loadbalancers']: 'cloud_databases', 'cloud_loadbalancers']:
module.fail_json(msg = 'Service %s is not supported at this time' % module.fail_json(msg = 'Service %s is not supported at this time' %