ansible remove all the partitions

[root@localhost ~]# cat lvm.yml
---
 - hosts: all
   user: root
   become: yes
   become_method: sudo
   tasks:
        - name: Create a new primary partition
          parted:
            device: /dev/sdb
            number: 1
            state: absent

        - name: Create a new primary partition for LVM
          parted:
            device: /dev/sdb
            number: 5
            part_type: extended
            label: gpt
            name: UberPartition4
            state: absent
            part_end: 1GiB
        - name: Create EFI partitions
          parted:
            label: gpt
            state: absent
            device: /dev/sdc
            part_start: 0%
            part_end: 512MiB
            number: 1
        - name: Create EFI partitions
          parted:
            label: gpt
            state: absent
            device: /dev/sdc
            part_start: 512MiB
            part_end: 1024MiB
            number: 5

[root@localhost ~]#


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

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

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

TASK [Create a new primary partition] ******************************************
changed: [192.168.0.102]
changed: [192.168.0.100]

TASK [Create a new primary partition for LVM] **********************************
ok: [192.168.0.102]
ok: [192.168.0.100]

TASK [Create EFI partitions] ***************************************************
changed: [192.168.0.102]
changed: [192.168.0.100]

TASK [Create EFI partitions] ***************************************************
ok: [192.168.0.102]
ok: [192.168.0.100]

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

[root@localhost ~]#

Comments