# Ansible showing incorrect info when i try to find free space in switch, please help

**URL:** <https://forum.ansible.com/t/ansible-showing-incorrect-info-when-i-try-to-find-free-space-in-switch-please-help/34732>\
**Category:** Ansible Project\
**Created:** [March 7, 2021, 1:32am UTC](https://forum.ansible.com/t/ansible-showing-incorrect-info-when-i-try-to-find-free-space-in-switch-please-help/34732 "2021-03-07T01:32:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikram\_S](https://avatars.discourse-cdn.com/v4/letter/v/90db22/32.png) [@Vikram\_S](https://forum.ansible.com/u/Vikram_S)\
**Post date:** [March 7, 2021, 1:32am UTC](https://forum.ansible.com/t/ansible-showing-incorrect-info-when-i-try-to-find-free-space-in-switch-please-help/34732/1 "2021-03-07T01:32:57Z")

</div>

I have written a script to check for free space in switch before i proceed to copy image. I used ios\_facts module and i used below return values however the free and total space displayed is incorrect than the actual free/total space i saw in switch. Why is this happening?

Incorrect value shown for 2960 and 3650 switch but correct value shown when i run the same script in GNS3 router. Even when i convert the bytes/kb shown to MB, it is inccorect.

How to fix this or is there an alternate way to gather freee space and proceed with copying image only if free space is above certain MB?

ansible\_net\_memfree\_mb ansible\_net\_memtotal\_mb ansible\_net\_filesystems\_info

- name: Gather IOS Facts

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 7, 2021, 7:07pm UTC](https://forum.ansible.com/t/ansible-showing-incorrect-info-when-i-try-to-find-free-space-in-switch-please-help/34732/2 "2021-03-07T19:07:22Z")

</div>

Nothing prevents you from running a script that returns whatever you want, and use that in the conditional logic in subsequent tasks
