I'm having an issue with the cisco.ios_command module when used to accesss an AP and become enable

  • I’m having an issue with the cisco.ios_command module when used to access an AP and become enable. I get the following error:
    “msg”: “failed to elevate privilege to enable mode, at prompt [b’\rAP-APB-FL1-AP14#'] with error: unable to fetch privilege, with error: show privilege\r\n ^\r\n% Invalid input detected at ‘^’ marker.\r\n\rAP-APB-FL1-AP14#”

As you can see by the prompt it did correctly become enable, but the AP does not have the command show privilege available so it errors out. I’m trying to find a way to bypass that one check so I can run this playbook against multiple AP’s that need a reboot. I can ssh from CLI direct to the AP by dns name, login, and elevate with enable using the passwords in the file.

  • Code below

---
-
  name: "Current AP Image"
  hosts: all
  gather_facts: no
  vars:
    date: "{{ lookup('pipe', 'date +%Y%m%d') }}"
  tasks:

  - name: testing commands to AP
    cisco.ios.ios_command:
      commands:
      -  command: "reload"
         prompt: "Proceed with reload? [confirm]"
         answer: "\r"
    ignore_errors: yes

```end

```hosts

## Ansible Hosts File

all:
WLC1_APS:
  vars:
    ansible_connection: network_cli
    ansible_network_os: cisco.ios.ios
    ansible_user: admin
    ansible_become: yes
    ansible_become_method: enable
    ansible_password: (removed)
    ansible_become_password: (removed)

    ansible_command_timeout: 1200
    ansible_check_mode: no
    ansible_ignore_errors: true

  hosts:
    NAME_OF_AP_GOES_HERE

```end

```ansible.cfg

#Ansible local config file
[defaults]
inventory = ./hosts
#Use local hosts file in folder
host_key_checking = False
#Don't worry about RSA Fingerprints
retry_files_enabled = False
#Don't create .retry files on job failure
forks = 4
#The number of devices to try to connect to at once
ansible_comamnd_timeout = 600
#Delay for command to complete
authorize = yes
ignore_errors = True

```end

:




#cisco #ios #become #wireless