please help me to create a swap partition using ansible

hello all iam trying to create the swap partition using

  • name: creating lvm partition
    parted:
    device: /dev/sdb
    number: 1
    flags: [ swap ]
    state: present
    part_end: 1GiB

but i didn’t get the exact flag name is that any other method for creating it

flag swap is something completely different and not what you are after.

After looking at the code I see that you cant create a partition with type set to swap/82 with the parted module.
So your option is to do it with commands using command/shell module.

thank you sir