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

183 views
Skip to first unread message

Swathi Cutie

unread,
Apr 26, 2017, 10:16:54 AM4/26/17
to Ansible Project

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

Dick Davies

unread,
Apr 26, 2017, 3:46:23 PM4/26/17
to ansible list
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)
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e1c356ca-d4a1-4462-93b0-988d4de133c6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

cutiee

unread,
Apr 26, 2017, 6:06:58 PM4/26/17
to Ansible Project, di...@hellooperator.net
Thank you  got it !
Reply all
Reply to author
Forward
0 new messages