Today I learned how to create and manipulate partitions with ansible using the parted module. One useful tip, that is not listed in documentation, is using the device information in order to create partitions appropriately. For example to create a partition that start where the last partion begins ans space all the space left.

- name: Create partition if it does not exist
  community.general.parted:
    device: /dev/vdb
    number: "{{ device_info.partitions | length }}"
    flags: [ lvm ]
    part_end: "100%"
    part_start: "{{ device_info.partitions[-1].end }}MiB"
    state: present

docs