ansible lvm remove volume groups

[root@localhost ~]# cat lvm.yml
---
 - hosts: all
   user: root
   become: yes
   become_method: sudo
   tasks:
        - name: dbvg volume group creation
          lvg:
               vg: vg
               pvs: /dev/sdb
               state: absent
               force: yes
        - name: dbvg volume group creation
          lvg:
               vg: vgc
               pvs: /dev/sdc
               state: absent
               force: yes


[root@localhost ~]# ansible-playbook lvm.yml

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [192.168.0.102]
ok: [192.168.0.100]

TASK [dbvg volume group creation] **********************************************
changed: [192.168.0.102]
changed: [192.168.0.100]

TASK [dbvg volume group creation] **********************************************
changed: [192.168.0.102]
changed: [192.168.0.100]

TASK [db00 lvm creation] *******************************************************
fatal: [192.168.0.102]: FAILED! => {"changed": false, "err": "  Volume group \"vg\" not found\n  Cannot process volume group vg\n", "msg": "Volume group vg does not exist.", "rc": 5}
fatal: [192.168.0.100]: FAILED! => {"changed": false, "err": "  Volume group \"vg\" not found\n  Cannot process volume group vg\n", "msg": "Volume group vg does not exist.", "rc": 5}

to retry, use: --limit @/root/lvm.retry

PLAY RECAP *********************************************************************
192.168.0.100              : ok=3    changed=2    unreachable=0    failed=1 
192.168.0.102              : ok=3    changed=2    unreachable=0    failed=1 

[root@localhost ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- <26.00g                                                   
  swap centos -wi-ao----   3.00g                                                   
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  centos lvm2 a--  <29.00g     0
  /dev/sdb          lvm2 ---   10.00g 10.00g
  /dev/sdc          lvm2 ---   10.00g 10.00g
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <29.00g    0
[root@localhost ~]#

Comments

Popular posts from this blog

ansible redhat cluster qorum qdevice

PE 3.9.0 on centos 6

gfs2 cluster