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.

Reply via email to