mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add pv_options to lvg module so that, for example, metadatasize can b… (#21822)
* Add pv_options to lvg module so that, for example, metadatasize can be specified (e.g. for openstack cinder volumes) * Fixing version added
This commit is contained in:
parent
54a3bcc4ec
commit
a0370b8254
1 changed files with 10 additions and 2 deletions
|
@ -37,6 +37,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
|
||||||
|
pv_options:
|
||||||
|
description:
|
||||||
|
- Additional options to pass to C(pvcreate) when creating the volume group.
|
||||||
|
default: null
|
||||||
|
required: false
|
||||||
|
version_added: "2.3"
|
||||||
vg_options:
|
vg_options:
|
||||||
description:
|
description:
|
||||||
- Additional options to pass to C(vgcreate) when creating the volume group.
|
- Additional options to pass to C(vgcreate) when creating the volume group.
|
||||||
|
@ -124,6 +130,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),
|
||||||
|
pv_options=dict(default=''),
|
||||||
vg_options=dict(default=''),
|
vg_options=dict(default=''),
|
||||||
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'),
|
||||||
|
@ -135,6 +142,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']
|
||||||
|
pvoptions = module.params['pv_options'].split()
|
||||||
vgoptions = module.params['vg_options'].split()
|
vgoptions = module.params['vg_options'].split()
|
||||||
|
|
||||||
dev_list = []
|
dev_list = []
|
||||||
|
@ -191,7 +199,7 @@ def main():
|
||||||
### create PV
|
### create PV
|
||||||
pvcreate_cmd = module.get_bin_path('pvcreate', True)
|
pvcreate_cmd = module.get_bin_path('pvcreate', True)
|
||||||
for current_dev in dev_list:
|
for current_dev in dev_list:
|
||||||
rc,_,err = module.run_command("%s -f %s" % (pvcreate_cmd,current_dev))
|
rc,_,err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)])
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
@ -232,7 +240,7 @@ def main():
|
||||||
### create PV
|
### create PV
|
||||||
pvcreate_cmd = module.get_bin_path('pvcreate', True)
|
pvcreate_cmd = module.get_bin_path('pvcreate', True)
|
||||||
for current_dev in devs_to_add:
|
for current_dev in devs_to_add:
|
||||||
rc,_,err = module.run_command("%s -f %s" % (pvcreate_cmd, current_dev))
|
rc,_,err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)])
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue