Hello Jon

Yes I know the issue and it was intentional, what Im trying to do is to 
test if this works or not.

    - name: my task
      shell: ./print.py
      when: failed  == '1'
      register: task
      tags: task

Thanks. 

El martes, 12 de febrero de 2019, 3:35:54 (UTC-3), Jon Spriggs escribió:
>
> If you spot, in the logs, it shows that it's breaking on the 
> "ethernet0/1", and, if I read it right that's in the "/" in that... So it's 
> probably worth wrapping any instance of "ethernet0/1" in quotes, like I 
> did.
>
> Give that a whirl, and try again :)
>
> ---
> Jon "The Nice Guy" Spriggs
> @jontheniceguy everywhere...
> https://jon.sprig.gs
>
> On Mon, 11 Feb 2019, 21:00 'Tcpip' via Ansible Project <
> ansible...@googlegroups.com <javascript:> wrote:
>
>> This is the playbook Im using for test.
>>
>> ---                                                                      
>>                                                                             
>>                                                                             
>>              
>> - hosts: all
>>   gather_facts: false
>>   connection: local
>>   vars:
>>    cli:
>>     #host: "{{ inventory_hostname}}"
>>     username: cisco
>>     password: cisco
>>   tasks:
>>  
>>     - name: Shutdown Interface
>>       ios_interface:
>>         name: Ethernet0/1
>>         enabled: False
>>         state: down
>>         provider: "{{ cli }}"
>>       register: first
>>  
>>     - pause:
>>         seconds=3
>>  
>>     - name: Startup Interface
>>       ios_interface:
>>         name: Ethernet0/1
>>         enabled: True
>>         state: up
>>         provider: "{{ cli }}"
>>  
>>     - name: my task
>>       shell: ./print.py
>>       when: failed  == '1'
>>       register: task
>>       tags: task
>>  
>>     - debug: var=task.stdout_lines[0]
>>       tags: show_task
>>
>> the ./print.py is just showing the "hello" but is not working
>>
>> The full traceback is:
>> Traceback (most recent call last):
>>   File "/tmp/ansible_62pEWK/ansible_module_ios_interface.py", line 490, 
>> in <module>
>>     main()
>>   File "/tmp/ansible_62pEWK/ansible_module_ios_interface.py", line 478, 
>> in main
>>     load_config(module, commands)
>>   File 
>> "/tmp/ansible_62pEWK/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py",
>>  
>> line 168, in load_config
>>   File 
>> "/tmp/ansible_62pEWK/ansible_modlib.zip/ansible/module_utils/connection.py", 
>> line 174, in __rpc__
>> ansible.module_utils.connection.ConnectionError: interface Ethernet0/1
>>                                ^
>> % Invalid input detected at '^' marker.
>>
>> CBR1(config)#
>>
>> fatal: [cbr1]: FAILED! => {
>>     "changed": false, 
>>     "module_stderr": "Traceback (most recent call last):\n  File 
>> \"/tmp/ansible_62pEWK/ansible_module_ios_interface.py\", line 490, in 
>> <module>\n    main()\n  File 
>> \"/tmp/ansible_62pEWK/ansible_module_ios_interface.py\", line 478, in 
>> main\n    load_config(module, commands)\n  File 
>> \"/tmp/ansible_62pEWK/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py\",
>>  
>> line 168, in load_config\n  File 
>> \"/tmp/ansible_62pEWK/ansible_modlib.zip/ansible/module_utils/connection.py\",
>>  
>> line 174, in __rpc__\nansible.module_utils.connection.ConnectionError: 
>> interface Ethernet0/1\r\n                               ^\r\n% Invalid 
>> input detected at '^' marker.\r\n\r\nCBR1(config)#\n", 
>>     "module_stdout": "", 
>>     "msg": "MODULE FAILURE", 
>>     "rc": 
>>
>> Thanks. 
>>
>> El lunes, 11 de febrero de 2019, 13:10:19 (UTC-3), Tcpip escribió:
>>>
>>> Hi all,
>>>
>>> I need to execute a script every time PLAY RECAP  failed=1, how can I 
>>> configure my Ansible Playbook to do this?
>>>
>>> Thanks. 
>>>
>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4aab0ed9-4cf5-420b-9b94-5bfc9d0f965d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4aab0ed9-4cf5-420b-9b94-5bfc9d0f965d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/66c1d7ea-dac3-48b7-a22b-422340592c11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to