提升至特权级别

Elevate to Privilege Level

当我在 GNS3 上的 Ansible 上 运行 时,我收到了这个错误。谁能帮我解决这个错误?

主机文件

[ios]
172.20.10.55

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

剧本

- 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

错误

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

您需要设置ansible_become_password

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