1st playbook uses ios_command module and gets executed as intended (to 
display the output when hostname of device contains router1).

However 2nd playbook uses ios_config module and fails when i use the 'when' 
conditional. Am i do something wrong or is it that 'when' conditional is 
not supposed to work with ios_config module?  (please ignore the formatting)

---

- name: show hostname

  hosts: R1


  tasks:

    - name: show hostname

      ios_command: 

        commands: "show run | i hostname"

            

      register: output

 

    - debug:

        var: output

      when: "'router1' in output.stdout[0]"

-------------------------------------------------

---

- name: show hostname

  hosts: R1


  tasks:

    - name: show hostname

      ios_config: 

        lines: 

          - hostname router1   

            

      register: output

 

    - debug:

        var: output

      when: "'router1' in output.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/8bb51686-7f9a-4c88-8148-b94063103649n%40googlegroups.com.

Reply via email to