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

**URL:** <https://forum.ansible.com/t/how-to-check-the-physical-memory-and-free-disk-is-greater-than-some-value/24324>\
**Category:** Ansible Project\
**Created:** [April 26, 2017, 2:16pm UTC](https://forum.ansible.com/t/how-to-check-the-physical-memory-and-free-disk-is-greater-than-some-value/24324 "2017-04-26T14:16:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swathi\_Cutie](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Swathi\_Cutie](https://forum.ansible.com/u/Swathi_Cutie)\
**Post date:** [April 26, 2017, 2:16pm UTC](https://forum.ansible.com/t/how-to-check-the-physical-memory-and-free-disk-is-greater-than-some-value/24324/1 "2017-04-26T14:16:54Z")

</div>

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.

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

```

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [April 26, 2017, 7:46pm UTC](https://forum.ansible.com/t/how-to-check-the-physical-memory-and-free-disk-is-greater-than-some-value/24324/2 "2017-04-26T19:46:18Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Swathi\_Cutie](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Swathi\_Cutie](https://forum.ansible.com/u/Swathi_Cutie)\
**Post date:** [April 26, 2017, 10:06pm UTC](https://forum.ansible.com/t/how-to-check-the-physical-memory-and-free-disk-is-greater-than-some-value/24324/3 "2017-04-26T22:06:57Z")

</div>

Thank you got it !
