Hi Vikram,
Find here <https://github.com/teofilmihance/ios_switch_update.git> an
ansible role that includes among others a MD5 checksum task, file_check.yml
<https://github.com/teofilmihance/ios_switch_update/blob/main/roles/switch_update/tasks/file_check.yml>
 and checksum.py
<https://github.com/teofilmihance/ios_switch_update/blob/main/roles/switch_update/tasks/checksum.py>
It is a draft but is working fine.
Best regards
Teo

On Wed, Mar 31, 2021 at 3:38 AM Vikram S <[email protected]> wrote:

> Below is the script i have written to perform MD5 verification for stacked
> switch 2. Problem with this script is that iam saving output of MD5
> verification command to a custom varriable called 'md5_flash2' using
> register and then checking if correct md5 value is present there.
>
> Since iam using register, so only the output of last device will get saved
> (and over-write previous data) in this custom variable. So iam forced to
> check MD5 verification for 1 device at a time. Is there any alternate way
> to write script to do do MD5 verification (and other tasks) simultaneously
> for several devices?
>
>  - name: DO MD5 VERIFICATION FOR FLASH 2 AND END PLAYBOOK IF IT FAILS
>
>       block:
>
>       - ios_command:
>
>           commands: "verify /md5
> flash2:/c2960x-universalk9-mz.152-7.E3/c2960x-universalk9-mz.152-7.E3.bin"
>
>         vars:
>
>           ansible_command_timeout: 360
>
>
>         register: md5_flash2
>
>
>       - debug:
>
>           msg: MD5 VERIFICATION IS SUCCESSFUL FOR FLASH 2
>
>         when: "'f148fc860a1d4d08532bc616724e632d' in md5_flash2.stdout[0]"
>
>
>       - meta: end_host
>
>         when: "'f148fc860a1d4d08532bc616724e632d' not in
> md5_flash2.stdout[0]"
>
>
>       when:
>
>         - "'Switch 02' in show_version.stdout[0]"
>
> --
> 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/7d337e4d-7e6f-461c-a975-45447925e9a5n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7d337e4d-7e6f-461c-a975-45447925e9a5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CA%2B7EwT8whzjT9tXa-haX0m2VA5%2Bh5_6Je8erYf5DFVNrwVKwuA%40mail.gmail.com.

Reply via email to