移除 lv

  1. 寫 lvremove.yml 腳本移除先前新增的 lv /dev/fieldwork/test。
    [deyu1@kvm19 ansible]$ vim lvremove.yml
    [deyu1@kvm19 ansible]$ cat lvremove.yml
    ---
    - hosts: dev 
      tasks:
      - block:
        - name: Remove a logical volume
          lvol:
            vg: fieldwork
            lv: test
            state: absent
            force: yes
    
  2. ansible-playbook 執行 lvremove.yml 腳本,成功刪除 lv test。
    [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