Add 'vgoptions' parameter to lvg module.

Allows specifying extra flags to pass to `vgcreate`.
This commit is contained in:
C. Morgan Hamill 2014-02-18 11:11:18 -05:00
parent 3e32654f9d
commit 5776c95497

View file

@ -41,6 +41,12 @@ options:
- The size of the physical extent in megabytes. Must be a power of 2.
default: 4
required: false
vgoptions:
description:
- Additional options to pass to C(vgcreate) when creating the volume group.
default: null
required: false
version_added: "1.5"
state:
choices: [ "present", "absent" ]
default: present
@ -99,6 +105,7 @@ def main():
vg=dict(required=True),
pvs=dict(type='list'),
pesize=dict(type='int', default=4),
vgoptions=dict(),
state=dict(choices=["absent", "present"], default='present'),
force=dict(type='bool', default='no'),
),
@ -109,6 +116,7 @@ def main():
state = module.params['state']
force = module.boolean(module.params['force'])
pesize = module.params['pesize']
vgoptions = module.params.get('vgoptions', '').split()
if module.params['pvs']:
dev_string = ' '.join(module.params['pvs'])
@ -168,7 +176,7 @@ def main():
else:
module.fail_json(msg="Creating physical volume '%s' failed"%current_dev, rc=rc, err=err)
vgcreate_cmd = module.get_bin_path('vgcreate')
rc,_,err = module.run_command("%s -s %s %s %s"%(vgcreate_cmd, pesize, vg, dev_string))
rc,_,err = module.run_command([vgcreate_cmd] + vgoptions + ['-s', str(pesize), vg, dev_string])
if rc == 0:
changed = True
else: