0

When I am running this on Ansible on GNS3, I am getting this error. Can anyone please help me with this error?

Hosts File

[ios]
172.20.10.55

[ios:vars]
ansible_network_os=ios
ansible_user=admin
ansible_password=cisco
ansible_become=yes
ansible_become_method=enable

Playbook

- name: multiple commands
  hosts: ios
  gather_facts: false
  connection: network_cli
  tasks:
    - name: configure ospf
      ios_config:
        lines:
          - configure terminal
          - 10 pemrit ip host 192.168.1.1 any log
        parents: ip access-list extended test

Error

TASK [configure ospf] **********************************************************
fatal: [172.20.10.55]: FAILED! => {"changed": false, "msg": "unable to elevate privilege to enable mode, at prompt [\nR1>] with error: failed to elevate privilege to enable mode still at prompt [\nR1>]"}

PLAY RECAP *********************************************************************
172.20.10.55               : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
MUSR
  • 133
  • 1
  • 4
  • Try adding that `ansible_become: yes` and `ansible_become_method: enable` and `ansible_become_password: "{{ansible_become_password}}"` to the `ios_config` module options. – Jack May 22 '20 at 15:50
  • Oh, wait. Try setting `ansible_become_password` in your vars. – Jack May 22 '20 at 15:51
  • @Jack There is no such variable ansible_become_password in network_cli – MUSR May 23 '20 at 07:46
  • The docs say there is: https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html – Jack May 23 '20 at 11:38
  • Strange. Here they mention it but in network_cli documentation there isn't any. I will try it and let you know. Thanks. https://docs.ansible.com/ansible/latest/plugins/connection/network_cli.html – MUSR May 23 '20 at 11:39
  • @Jack Thanks!! It solved the issue :)) – MUSR May 24 '20 at 12:40
  • I'll make it an answer, then! – Jack May 24 '20 at 15:50

1 Answers1

1

You need to set ansible_become_password.

https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html

Jack
  • 5,801
  • 1
  • 15
  • 20