diff --git a/library/system/lvg b/library/system/lvg index bc4709e3b1..48d1fd3d4e 100644 --- a/library/system/lvg +++ b/library/system/lvg @@ -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: