Hi,

I have written the below script to check if packages.conf has been updated 
(by checking it's date) in flash and if so, to set it as boot statement for 
switch. But ansible does not seem to consider the when conditional at all. 
It sets the boot statement regardless of whether the condition matches or 
not.
But below 'when' syntax works for ios_command module. Should i modify the 
syntax or am i writing it wrong?


 - name: GATHER PACKAGES.CONF FILE INFO IN FLASH
      ios_command:
        commands: "show flash: | i packages.conf"

      register: show_flash_packages

    - name: ADD PACKAGES.CONF AS BOOT STATEMENT WHEN THIS FILE IS UPDATED
      ios_config:
        lines:
          - boot system flash:packages.conf
      when:  
        - "'Apr 09 2021' in show_flash_packages.stdout[0] or
          'Apr 10 2021' in show_flash_packages.stdout[0]"

Thanks,
Vikram

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ea53769d-3763-41ab-9e3b-fc267dc16d64n%40googlegroups.com.

Reply via email to