ios_facts module, add bytes total and bytes free

I’m not much of a python developer, but i’m using ansible now for upgrading IOS devices.

One thing that would be helpful would if ios_facts could also gather the flash memory total and free bytes:

EX:

Directory of flash:/

2 -rwx 916 Jan 29 2019 11:56:49 -06:00 vlan.dat
3 -rwx 26590208 Dec 18 2018 09:28:36 -06:00 c2960x-universalk9-mz.152-6.E2.bin
4 -rwx 14236 Jan 29 2019 17:50:43 -06:00 private-config.text
5 -rwx 21287936 Jan 16 2019 16:10:33 -06:00 c2960x-universalk9-mz.152-2.E8.bin
9 -rwx 8216 Jan 29 2019 11:56:55 -06:00 multiple-fs
6 -rwx 29835 Jan 29 2019 09:51:58 -06:00 ansible_backup_running.cfg
8 -rwx 23655 Jan 29 2019 17:50:43 -06:00 config.text

122185728 bytes total (73838592 bytes free) <=============

Gathering these numbers would be helpful to help determine if there’s enough free flash memory before attempting to copy the new file into flash.

Ok, I think I got it.

dir from switch:

pdctestisesw7#dir
Directory of flash:/

2 -rwx 916 Jan 29 2019 11:56:49 -06:00 vlan.dat
3 -rwx 26590208 Dec 18 2018 09:28:36 -06:00 c2960x-universalk9-mz.152-6.E2.bin
4 -rwx 14236 Jan 29 2019 17:50:43 -06:00 private-config.text
5 -rwx 21287936 Jan 16 2019 16:10:33 -06:00 c2960x-universalk9-mz.152-2.E8.bin
9 -rwx 8216 Jan 29 2019 11:56:55 -06:00 multiple-fs
6 -rwx 29835 Jan 29 2019 09:51:58 -06:00 ansible_backup_running.cfg
8 -rwx 23655 Jan 29 2019 17:50:43 -06:00 config.text

122185728 bytes total (73838592 bytes free)
pdctestisesw7#

I’m able to get these values now:

ansible_net_bytes_free: ‘73838592’
ansible_net_bytes_total:

  • ‘122185728’

How do I submit this to Ansible for approval?

Please open an issue here https://github.com/ansible/ansible/issues to get this added to the current ios_facts module