Hi@akhtar,
You can use the mount module in your playbook. This module is used to mount any drive to a folder. But we can use this module to remove swapfile as well. You can see the below example.
  - name: Remove swapfile from /etc/fstab
    mount:
      name: "{{ item }}"
      fstype: swap
      state: absent
    with_items:
      - swap