[deyu1@kvm19 ansible]$ vim lvremove.yml [deyu1@kvm19 ansible]$ cat lvremove.yml --- - hosts: dev tasks: - name: Remove the logical volume. community.general.lvol: vg: fieldwork lv: test state: absent force: true
[deyu1@kvm19 ansible]$ ansible-playbook lvremove.yml PLAY [dev] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [kvm11] TASK [Remove a logical volume] ************************************************* 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 root vg_kvm11 -wi-ao---- 3.32g swap vg_kvm11 -wi-ao---- 96.00m