run ios_command in enable mode

21 views
Skip to first unread message

Akku

unread,
Aug 3, 2017, 1:05:19 PM8/3/17
to Ansible Project
========================================================================================
ansible 2.2.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
========================================================================================

I am using below ---playbook to show the version of a Cisco router, and getting the below error.

- hosts: "{{ target }}"
  connection: local

  tasks:

  - name: Defining the provider
    set_fact:
      provider:
        host: "{{ target }}"
        username: "{{ network_device_user }}"
        password: "{{ ansible_ssh_pass }}"
        auth_pass: "{{ network_device_enable_pass }}"
        port: "{{ port }}"
        transport: cli
        timeout: 50

  - name: Run Show Version
    ios_command:
      provider: "{{ provider }}"
      authorize: yes
      commands:
        - show version
    register: version
  - debug: var=version.stdout_lines

=========================================================================================

fatal: [10.251.58.221]: FAILED! => {"changed": false, "failed": true, "msg": "timeout trying to send command: enable\
r"}

=========================================================================================

If am removing the "authorize: yes" from the task, it works.. 
Do we have any other way to work the task with authorize ( enabled mode).

==========================================================================================
Reply all
Reply to author
Forward
0 new messages