【发布时间】:2020-05-13 17:29:26
【问题描述】:
我似乎在使用 Ansible 创建最基本的剧本时遇到了问题,我不确定如何解决我的问题。我收到以下错误...
“致命:[10.1.3.1]:失败!=>更改=假 msg:操作需要提权 致命:[10.1.3.49]:失败! => 改变=假 msg: 操作需要提权"
下面是我的“ansible.cfg”文件-
[defaults]
inventory = hosts
stdout_callback = yaml
host_key_checking = False
retry_files_enabled = False
interpreter_python = auto_silent
[persistent_connection]
connect_timeout = 60
command_timeout = 60
下面是我的“config.yml”剧本-
---
- name: General Config
hosts: Network_Devices
tasks:
- name: Add Banner
ios_banner:
banner: login
text: |
Nicolas Cage is the
Tiger King
state: present
- name: Add loopback
ios_interface:
name: Loopback21
state: present
最后是我的“主机”文件-
[Network_Devices]
10.1.3.49
10.1.3.1
[Network_Devices:vars]
ansible_user=root
ansible_password=cisco
ansible_connection = network_cli
ansible_network_os=ios
【问题讨论】:
-
您似乎需要启用权限提升。参见例如docs.ansible.com/ansible/latest/user_guide/…
-
不幸的是,我尝试了这个并得到了错误 - '无法提升权限以启用模式,在提示 [None] 时出现错误:尝试发送命令时达到超时值 30 秒:b''enable' ''