[deyu1@kvm19 ansible]$ ansible-doc lvol | grep ^EX -A6 EXAMPLES: - name: Create a logical volume of 512m community.general.lvol: vg: firefly lv: test size: 512
[deyu1@kvm19 ansible]$ ansible dev -m shell -a "vgs" kvm11 | CHANGED | rc=0 >> VG #PV #LV #SN Attr VSize VFree fieldwork 1 0 0 wz--n- 296.00m 296.00m vg_kvm11 1 2 0 wz--n- 3.41g 0
[deyu1@kvm19 ansible]$ cat lvfs.yml --- - hosts: dev tasks: - name: Create a logical volume of 100m community.general.lvol: vg: fieldwork lv: test size: 100
[deyu1@kvm19 ansible]$ ansible-playbook lvfs.yml PLAY [dev] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [kvm11] TASK [Create a logical volume of 100m] ***************************************** changed: [kvm11] PLAY RECAP ********************************************************************* kvm11 :ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[deyu1@kvm19 ansible]$ ansible dev -m shell -a "lvs" kvm11 | CHANGED | rc=0 >> LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert test fieldwork -wi-a----- 100.00m root vg_kvm11 -wi-ao---- 3.32g swap vg_kvm11 -wi-ao---- 96.00m