If you are not familiar with modules, check out Ansible - Getting Started with Modules.
The lvg module can be used to create an LVM volume group, delete an LVM volume group, and to add or remove physical volumes from a volume group. In this example, volume group vg001 is created, and physical volume /dev/sda1 is in the volume group.
---
- hosts: all
tasks:
- name: create LVM volume group vg001
lvg:
vg: vg001
pvs: /dev/sda1
pesize: 32
...
In this example, physical volume /dev/sdb1 is added to volume group vg001.
---
- hosts: all
tasks:
- name: add physical volume /dev/sdb1 to volume group vg001
lvg:
vg: vg001
pvs: /dev/sdb1
...
In this example, volume group vg001 is removed.
---
- hosts: all
tasks:
- name: remove LVM volume group vg001
lvg:
vg: vg001
state: absent
...