You can use the parted module for partitioning
Format with BTRFS or many others
These might come in handy:
- https://docs.ansible.com/ansible/latest/collections/community/general/btrfs_info_module.html#ansible-collections-community-general-btrfs-info-module
- https://docs.ansible.com/ansible/latest/collections/community/general/btrfs_subvolume_module.html#ansible-collections-community-general-btrfs-subvolume-module
For ZFS, I'm not familiar but I found
Here's the index of all modules: https://docs.ansible.com/ansible/latest/collections/index_module.html