我当前正在运行ansible 2.7,并且具有以下剧本
info.yaml
---
- hosts: routers
gather_facts: true
tasks:
- name: show run
ios_command:
commands:
- show running-config
register: config
我有以下清单文件:
[local]
127.0.0.1 ansible_connection=local
[routers]
LAB-RTR-1
LAB-RTR-2
[routers:vars]
ansible_ssh_user= {{ cisco_user }}
ansible_ssh_pass= {{ cisco_pass }}
ansible_network_os=ios
ansible_connection=network_cli
ansible_become = yes
ansible_become_method = enable
anisble_become_pass = {{ auth_pass }}
在金库中具有以下内容
cisco_user: “admin”
cisco_pass: “password123”
auth_pass: “password123”
当我尝试通过cli这样运行时:
ansible-playbook info.yaml --ask-vault-pass -vvv
由于某些原因,我不断收到以下错误,但我无法解决。过去几个小时,我一直在为此发疯
The full traceback is:
Traceback (most recent call last):
File "/usr/bin/ansible-connection", line 106, in start
self.connection._connect()
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 341, in _connect
self._terminal.on_become(passwd=auth_pass)
File "/usr/lib/python2.7/site-packages/ansible/plugins/terminal/ios.py", line 78, in on_become
raise AnsibleConnectionFailure('unable to elevate privilege to enable mode, at prompt [%s] with error: %s' % (prompt, e.message))
AnsibleConnectionFailure: unable to elevate privilege to enable mode, at prompt [None] with error: timeout value 10 seconds reached while trying to send command: enable
fatal: [LAB-RTR-1]: FAILED! => {
"msg": "unable to elevate privilege to enable mode, at prompt [None] with error: timeout value 10 seconds reached while trying to send command: enable"
}
答案 0 :(得分:0)
一段时间未使用过ansible(但上面的方法对我来说似乎还可以),并且从不与cisco一起使用,但我发现了一个与您的问题非常相似的未解决问题,您可能需要密切注意: >