lvol – Configure AIX LVM logical volumes
Synopsis
This module creates, removes and modifies attributes of LVM logical volumes.
Requirements
The below requirements are needed on the host that executes this module.
AIX >= 7.1 TL3
Python >= 3.6
Privileged user with authorizations: aix.lvm.manage.change,aix.lvm.manage.create,aix.lvm.manage.remove
Parameters
- state (True, str, None)
Specifies the action to be performed on the logical volume.
present
creates or modifies the logical volume if already exists with lv_attributes.
absent
removes a logial volume.- lv (True, str, None)
Specified the logical volume name.
- vg (optional, str, None)
Specifies the volume group name this logical volume is part of.
Required when state=present.
- lv_type (optional, str, jfs2)
Specifies the type of the logical volume to create.
The standard types are
jfs
for journaled file systems,jfslog
for journaled file system logs,jfs2
for enhanced journaled file system,jfs2log
for enhanced journaled file system logs,paging
for paging spaces.But you can define other logical volume types with this flag.
You cannot create a striped logical volume of type
boot
.Can be used to create a logical volume, hence when state=present.
- strip_size (optional, str, None)
Specifies the strip size of the striped logical volume to create.
Can be used to create a logical volume, hence when state=present.
- extra_opts (optional, str, )
Any other options to be passed by the user to mklv or chlv command
- copies (optional, int, 1)
Specifies number of copies of logical volume
Maximum value allowed is 3
Can be used to create a logical volume, hence when state=present.
- size (optional, str, None)
If you do not specify its value when trying to create a logical volume, default value ‘1’ is considered.
Specifies the number of logical partitions or the size of the the logical volume in terms of K, M, or G.
Can be used to create a logical volume, hence when state=present.
Can be used to increase the size of the logical volume if it already exist. If the input size is larger than the current logical volume size then extend the logical volume to match the input size. If the input size uses the prefix “+” sign, then the logical volume is extended by that amount.
Cannot be used to decrease the size of an existing logical volume.
Explicitly use quotations when using the “+” sign to denote string type.
- pv_list (optional, list, None)
List of pysical volumes.
Can be used to create a logical volume, hence when state=present.
- policy (optional, str, maximum)
Specifies the inter-physical volume allocation policy. It is the number of physical volumes to extend across, using the volumes that provide the best allocation.
maximum
allocates across the maximum number of physical volumes.
minimum
allocates logical partitions across the minimum number of physical volumes.Can be used to create or modify a logical volume, hence when state=present.
- lv_new_name (optional, str, None)
Specifies the name of the logical volume to change an existing logical volume.
Can be used to modify a logical volume, hence when state=present.
Notes
Note
Attention: using state=absent destroys all data in the specified logical volumes. If the logical volume spans multiple physical volumes, the removal of only logical partitions on the physical volume can jeopardize the integrity of the entire logical volume.
You can refer to the IBM documentation for additional information on the commands used at https://www.ibm.com/support/knowledgecenter/ssw_aix_72/c_commands/chlv.html, https://www.ibm.com/support/knowledgecenter/ssw_aix_72/m_commands/mklv.html, https://www.ibm.com/support/knowledgecenter/ssw_aix_72/r_commands/rmlv.html.
Examples
- name: Create a logical volume of 64M
ibm.power_aix.lvol:
vg: test1vg
lv: test1lv
size: "64M"
state: present
- name: Create a logical volume of 10 logical partitions with disks testdisk1 and testdisk2
ibm.power_aix.lvol:
vg: test2vg
lv: test2lv
size: "10"
pv_list: testdisk1, testdisk2
state: present
- name: Create a logical volume of 32M with a minimum placement policy
ibm.power_aix.lvol:
vg: rootvg
lv: test4lv
size: "32M"
policy: minimum
state: present
- name: Create a logical volume with extra options like mirror pool
ibm.power_aix.lvol:
vg: testvg
lv: testlv
size: "128M"
extra_opts: -p copy1=poolA -p copy2=poolB
state: present
- name: Extend a logical volume by 5G
ibm.power_aix.lvol:
vg: testvg
lv: testlv
size: "+5G"
state: present
- name: Extend a logical volume to 10G
ibm.power_aix.lvol:
vg: testvg
lv: testlv
size: "10G"
state: present
- name: Reduce the number of mirrors of a logical volume with three mirrors
ibm.power_aix.lvol:
vg: testvg
lv: testlv
copies: 2
state: present
- name: Increase the number of mirrors of a logical volume with one mirror
ibm.power_aix.lvol:
vg: testvg
lv: testlv
copies: 3
state: present
- name: Rename a logical volume
ibm.power_aix.lvol:
vg: testvg
lv: testlv
lv_new_name: renamedlv
state: present
- name: Remove the logical volume
ibm.power_aix.lvol:
state: absent
lv: test1lv
Return Values
- msg (always, str, Logical volume test1lv created.)
The execution message.
- cmd (always, str, )
The command executed.
- rc (When the command is executed., int, )
The command return code.
- stdout (always, str, )
The standard output of the command.
- stderr (always, str, )
The standard error of the command.
Status
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by community.