Its a bug in ios_config not properly handling the return prompt. Should
have a fix committed soon to address this

On Mon, Mar 28, 2016 at 3:55 PM, Uroš Bajželj <[email protected]>
wrote:

> Hello
>
> Thanks for the answer. I tried your suggested solution but it does not
> help.
>
> The problem is that if task fails in the block section, then the rescue
> section is initiated. But the task fails here as well.
>
> Trying to find other solution... :)
>
> BR,
>
> Uros
>
>
> Dne sobota, 26. marec 2016 15.49.30 UTC+1 je oseba Roger Gomez napisala:
>
>> Maybe you can try blocks Ansible Blocks
>> <http://docs.ansible.com/ansible/playbooks_blocks.html>, they work
>> pretty similar to Python Try/Except/Finally.
>> Thanks.
>>
>> On Friday, March 25, 2016 at 10:41:29 AM UTC-4, Uroš Bajželj wrote:
>>>
>>> Hello
>>>
>>> I am using ios_config module to configure crypto map on the router.
>>>
>>> When you configure the empty crypto map statement the router display the
>>> following note:
>>>
>>> HQ(config)#crypto map CMAP 10 ipsec-isakmp
>>>
>>> % NOTE: This new crypto map will remain disabled until a peer
>>>
>>> and a valid access list have been configured.
>>>
>>>
>>> The problem here is that this error fails the task and ansible does not
>>> execute all commands in list. Is there anyway to tell the ansible to ignore
>>> this message?
>>>
>>>
>>> This is my task:
>>>
>>>
>>>     - name: Configure crypto map
>>>
>>>       ios_config:
>>>
>>>         host: "{{ ansible_ssh_host }}"
>>>
>>>         username: "{{ username }}"
>>>
>>>         password: "{{ password }}"
>>>
>>>         lines:
>>>
>>>           - match address GRE-IPSEC
>>>
>>>         parents: ['crypto map CMAP {{ item.0 + 1 }} ipsec-isakmp']
>>>
>>>         before: ['no crypto map CMAP {{ item.0 + 1 }} ipsec-isakmp']
>>>
>>>         match: strict
>>>
>>>       with_indexed_items: '{{ groups.remote }}'
>>>
>>>       when: "inventory_hostname in groups.hq"
>>>
>>>
>>> I also tried to add "ignore_errors: yes". But still it does not execute
>>> all commands in the lines.
>>>
>>>
>>> I was reading about failed_when attribute but I was not able to
>>> implement this in the correct way.
>>>
>>> (failed_when: "'FAILED' in command_result.msg)
>>>
>>>
>>> Any ideas?
>>>
>>>
>>> BR,
>>>
>>>
>>> Uros
>>>
>> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/501de10e-e29c-44c2-8f21-5e85825b9dd1%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/501de10e-e29c-44c2-8f21-5e85825b9dd1%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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEkdrMgFkWmFfrY5GYKNPF1yNnYo%3DVrg3HcaocJy4aw0SV3GsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to