How to check the physical memory and free disk is greater than some value?

How to write an ansible task to check if the physical memory >=128 MB and free disk is >= 256 MB. i tried to get the output but i am not sure how to proceed further.

# Check the physical disk memory 128 MB and free disk 256 MB
 - name: check the physical memory
   command: free -m
   register: phy_mem

I'd use facts for that. The ones you want are probably

ansible_memtotal_mb

(total RAM in Mb)

and

ansible_mounts

(which gives free bytes per mounted device)

Thank you got it !