[deyu1@kvm19 ansible]$ ansible-doc lvg | grep ^EX -A6
EXAMPLES:
- name: Create a volume group on top of /dev/sda1 with physical extent size = 32MB
lvg:
vg: vg.services
pvs: /dev/sda1
pesize: 32
[deyu1@kvm19 ansible]$ vim partvg.yml
[deyu1@kvm19 ansible]$ cat partvg.yml
---
- hosts: dev
tasks:
- name: Create a new primary partition for LVM
parted:
device: /dev/vda
number: 3
flags: [ lvm ]
state: present
part_start: 3994624KiB
- name: Create VG
lvg:
vg: fieldwork
pvs: /dev/vda3
pesize: 2
[deyu1@kvm19 ansible]$ ansible-playbook partvg.yml PLAY [dev] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [kvm11] TASK [Create a new primary partition for LVM] ********************************** ok: [kvm11] TASK [Create VG] *************************************************************** [WARNING]: The value 2 (type int) in a string field was converted to '2' (type string). If this does not look like what you expect, quote the entire value to ensure it does not change. changed: [kvm11] PLAY RECAP ********************************************************************* kvm11 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0