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



On Sun, 7 Mar 2021 at 02:33, Vikram S <[email protected]> wrote:

> 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
>    ios_facts: subset: all
>       -
>
>       debug:
>
>       msg:
>       - "version is {{ ansible_net_memfree_mb }}"
>
>       register: print_output
>       -
>
>       name: DISPLAY IF SUFFICIENT SPACE IS THERE OR NOT assert:
>
>       that:
>       - ansible_net_memfree_mb >= 14920
>
>       fail_msg: "THERE IS not SUFFICIENT SPACE TO COPY IMAGE"
>
>       success_msg: "THERE IS SUFFICIENT SPACE TO COPY IMAGE"
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a7bbc4ad-d4fa-4f7f-bbbf-74c93c8b5cdcn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a7bbc4ad-d4fa-4f7f-bbbf-74c93c8b5cdcn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOGLGsKeH%3D78C_myu8oZEvqA%3DnGChwYaEPF8b0cDzSejQ%40mail.gmail.com.

Reply via email to