How to assign random name for vmware snapshot?

I am a newbie to ansible and I am trying to take a snapshot of multiple VM’s with a random snapshot name including the VM name (vmname + random number or timestamp).

I am able to take snapshot using the VM name with the below code:

You can use filters - https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html

Either - “{{ hostname | to_uuid }}” or “{{ ‘%Y_%m_%d_%H_%M_%S’ | strftime }}”

Thank you, Abhijeet. That worked!!