On 3/10/21 8:12 AM, Malith Perera wrote:
> I'm new to the Ansible world. I'm trying to create a playbook that gets the MD5 value from the Cisco IOS. The IOS
> verification run on Cisco with bunch of dots and give the MD5 at the end (below)
>
> *.........................................................................................................................................................Done!
> verify /md5 (flash:cat3k_caa-universalk9.16.12.04.SPA.bin) = 4bb3ad09220d0d38131662296568c717 *
>
> I'm trying to get just the MD5 value after the equal sign and write it to file. I tried the below but no luck.
>
> - name:
> checking the md5 ios_command: commands: - "verify /md5 flash:{{ios_file_name}} {{md5_value}}"
> msg: {{md5_result.stdout | regex.replace('.' , '')}}
> register: removed
>
> However the output of the remove variable still has all the dots. Could someone please assist me, I'm pretty sure the
> regex I use is not correct either. Thank you very much in advance.
"." is a special character in a regular expression, so you have to escape it as '\.'.
To catch multiple occurrences in a row add a plus sign '\.+'.
Regards
Racke
>
> --
> 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
>
ansible-proje...@googlegroups.com <mailto:
ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/f01a4336-6a46-4d1f-bc07-d8c4b16f4e83n%40googlegroups.com
> <
https://groups.google.com/d/msgid/ansible-project/f01a4336-6a46-4d1f-bc07-d8c4b16f4e83n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.