# Dirty way to get memory total from host

**URL:** <https://forum.ansible.com/t/dirty-way-to-get-memory-total-from-host/12019>\
**Category:** Ansible Project\
**Created:** [October 24, 2012, 1:01am UTC](https://forum.ansible.com/t/dirty-way-to-get-memory-total-from-host/12019 "2012-10-24T01:01:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dylan\_Silva](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@Dylan\_Silva](https://forum.ansible.com/u/Dylan_Silva)\
**Post date:** [October 24, 2012, 1:01am UTC](https://forum.ansible.com/t/dirty-way-to-get-memory-total-from-host/12019/1 "2012-10-24T01:01:02Z")

</div>

Hi all!

I am trying to write some logic to grab the current memory configuration of a host and use that information to choose template variables to build a configuration file. Has anyone attempted this? If so, what was the quick and dirty way that you grabbed memory totals.

Thanks!

---

<div class="post-metadata">

**Author:** ![Dylan\_Silva](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@Dylan\_Silva](https://forum.ansible.com/u/Dylan_Silva)\
**Post date:** [October 24, 2012, 5:01am UTC](https://forum.ansible.com/t/dirty-way-to-get-memory-total-from-host/12019/2 "2012-10-24T05:01:54Z")

</div>

I found the fact ansible\_memtotal\_mb.

What I ended up doing is define a value total based on memory total. I had to do this because I was getting an error trying to iterate on an int value.
