Add 'vgoptions' parameter to lvg module.
Allows specifying extra flags to pass to `vgcreate`.
This commit is contained in:
parent
5c3addac8d
commit
c29f2fb888
1 changed files with 9 additions and 1 deletions
10
system/lvg
10
system/lvg
|
@ -41,6 +41,12 @@ options:
|
||||||
- The size of the physical extent in megabytes. Must be a power of 2.
|
- The size of the physical extent in megabytes. Must be a power of 2.
|
||||||
default: 4
|
default: 4
|
||||||
required: false
|
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:
|
state:
|
||||||
choices: [ "present", "absent" ]
|
choices: [ "present", "absent" ]
|
||||||
default: present
|
default: present
|
||||||
|
@ -99,6 +105,7 @@ def main():
|
||||||
vg=dict(required=True),
|
vg=dict(required=True),
|
||||||
pvs=dict(type='list'),
|
pvs=dict(type='list'),
|
||||||
pesize=dict(type='int', default=4),
|
pesize=dict(type='int', default=4),
|
||||||
|
vgoptions=dict(),
|
||||||
state=dict(choices=["absent", "present"], default='present'),
|
state=dict(choices=["absent", "present"], default='present'),
|
||||||
force=dict(type='bool', default='no'),
|
force=dict(type='bool', default='no'),
|
||||||
),
|
),
|
||||||
|
@ -109,6 +116,7 @@ def main():
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
force = module.boolean(module.params['force'])
|
force = module.boolean(module.params['force'])
|
||||||
pesize = module.params['pesize']
|
pesize = module.params['pesize']
|
||||||
|
vgoptions = module.params.get('vgoptions', '').split()
|
||||||
|
|
||||||
if module.params['pvs']:
|
if module.params['pvs']:
|
||||||
dev_string = ' '.join(module.params['pvs'])
|
dev_string = ' '.join(module.params['pvs'])
|
||||||
|
@ -168,7 +176,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="Creating physical volume '%s' failed"%current_dev, rc=rc, err=err)
|
module.fail_json(msg="Creating physical volume '%s' failed"%current_dev, rc=rc, err=err)
|
||||||
vgcreate_cmd = module.get_bin_path('vgcreate')
|
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:
|
if rc == 0:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue