【发布时间】:2021-09-03 19:20:10
【问题描述】:
我正在关注 youtube 上的基本 Ansible 网络工程师演示,但收到以下错误:
ubuntu@DESKTOP-P91I0V3:~/Ansible/Networking$ ansible-playbook ansible-router\ play2.yml -v 使用 /etc/ansible/ansible.cfg 作为配置文件
播放 [Danny 的通用路由器配置] **************************************** ****************************************************** *****
TASK [全局配置设置] ***************************************** ****************************************************** ****************** 致命:[R1]:失败! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "操作需要提权"}
播放回顾 ************************************************ ****************************************************** ************************************ R1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0救出=0被忽略=0
我的剧本是这样的:
- name: Danny's Generic Router Configuration
hosts: R1
gather_facts: false
connection: local
vars:
cli:
username: admin
password: cisco
timeout: 100
tasks:
- name: Global config settings
ios_config:
provider: "{{ cli }}"
lines:
- ipv6 unicast-routing
- errdisable recovery interval 60
- security passwords min-length 5
- ip name-server 99.99.99.99
- no ip http server
- ip http secure-server
- snmp-server community ipvzero1 RO
- snmp-server community ipvzero2 RW
- ntp server 99.99.99.99
- banner motd &**********THIS IS Danny'S ROUTER - DO NOT MAKE CHANGES UNLESS AUTHORISED! YOU WILL BE PROSECUTED! **********&
register: print_output
- debug: var=print_output
我的配置文件如下所示:
[defaults]
inventory = ./hosts
#host_key_checking = false
timeout = 60
我已经厌倦了使用和不使用“host_key_checking” 我在 Stack Overflow 中看到其他人也遇到过类似的问题,但没有任何东西可以彻底解决我的问题。
我可以从我的 WSL2 Ubuntu 环境通过 SSH 连接到 R1。
谁能帮我解决这个“操作需要提权”的问题吗?
【问题讨论】:
标签: networking automation ansible privileges cisco