ansible create/delete extended partition

 - hosts: all
   user: root
   become: yes
   become_method: sudo
   tasks:
        - name: Create a new ext  partition with a size of 1GiB
          parted:
            device: /dev/sdb
            number: 5
            part_type: extended
            label: gpt
            name: UberPartition
            state: present
            part_end: 1GiB

[root@localhost mnt]# fdisk /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 071F694A-4DE6-4683-8F78-3C8788064CEC


#         Start          End    Size  Type            Name
 1         2048      2097151   1023M  Microsoft basic extended

Comments