# How to make ansible check for free space in EVERY member switches of a stack switch?

**URL:** <https://forum.ansible.com/t/how-to-make-ansible-check-for-free-space-in-every-member-switches-of-a-stack-switch/34715>\
**Category:** Ansible Project\
**Created:** [March 3, 2021, 4:57pm UTC](https://forum.ansible.com/t/how-to-make-ansible-check-for-free-space-in-every-member-switches-of-a-stack-switch/34715 "2021-03-03T16:57:34Z")\
**Posts on this page:** 1\
**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 3, 2021, 4:57pm UTC](https://forum.ansible.com/t/how-to-make-ansible-check-for-free-space-in-every-member-switches-of-a-stack-switch/34715/1 "2021-03-03T16:57:34Z")

</div>

Below is the config i use for checking if router flash memory has certain amount of free space and then copy IOS image to it if it has.

Now i need to do the same thing for stacked switch. But iam wondering if below config will be sufficient for checking free space in EVERY member switch flash of a stacked switch or will it only check master switch flash free space? (as i haven’t had an opportunity to test on prod yet)

Or do you suggest some other way to check free space of every member switch flash memory and then copy ios image to every member switch only if sufficient space exists?

- name: Gather IOS Facts  
ios\_facts:

- debug:  
msg:

- “Free space is {{ ansible\_net\_memfree\_mb }}”

- name: DISPLAY IF SUFFICIENT SPACE IS THERE OR NOT  
assert:  
that:

- ansible\_net\_memfree\_mb \>= 513  
fail\_msg: “THERE IS not SUFFICIENT SPACE TO COPY IMAGE. FREE UP SPACE FIRST”  
success\_msg: “THERE IS SUFFICIENT SPACE TO COPY IMAGE”
