In 2.1 there is no way to handle this.

We added a new capability in 2.2 (current devel branch) that will allow you
to do this.  The new task would look like this:

- name: Clear counters
  connection: local

  tasks:
    - ios_command:
      host: "{{ inventory_hostname }}"
      commands:
        - command: "clear counters {{ item }} "
          prompt: 'Clear "show interface" counters on this interface
[confirm]'
          response: c
      with_items:
        - "{{ lan_int }}"
      when:
        - '"ce" in group_names'


On Wed, Sep 21, 2016 at 11:42 AM, Valérie P <valeriepi...@gmail.com> wrote:

> Hi,
>
> I have a question regarding the network core module "ios_command". I want
> to clear counters on some interfaces through a play. When I send the
> command directly through an SSH connection, the process is the following :
>
> rtr-site6#clear counters GigabitEthernet 0/0
> Clear "show interface" counters on this interface [confirm]c
>
> The router expects me to confirm the action. I tried to do it with the
> following play:
>
> ---
>
> - name: Clear counters
>   connection: local
>   ios_command:
>     host: "{{ inventory_hostname }}"
>     commands:
>       - "clear counters {{ item }} "
>   with_items:
>     - "{{ lan_int }}"
>   when:
>     - '"ce" in group_names'
>
>
> But I received this error
>
> failed: [rtr-site6] (item=GigabitEthernet0/0) => {"failed": true, "item":
> "GigabitEthernet0/0", "msg": "timeout trying to send command: clear
> counters GigabitEthernet0/0 \r"}
>
> Is there a way to "confirm" this command with any network modules? I am
> using this on a Cisco 2921, here is the version.
> Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
> 15.5(3)M1, RELEASE SOFTWARE (fc2)
>
> Kind regards!
>
> Valerie
>
> --
> 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/fa4e7132-b296-460e-851a-d2f92f65bf78%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/fa4e7132-b296-460e-851a-d2f92f65bf78%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/CAEkdrMhdwtLApOcGhBV3qUqU7JLN7%3DeVxFiQNr171WtuNAC0yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to