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

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”