【问题标题】:Ansible Cisco Switch "Operation requires privilege escalation" *NetworkChuck Example*Ansible Cisco 交换机“操作需要提权”*NetworkChuck 示例*
【发布时间】: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' ''

标签: python ansible cisco


【解决方案1】:

过去几个月我一直在使用 ansible。在清单中设置“ansible_become_password”连接变量对我有用。来源-https://docs.ansible.com/ansible/latest/user_guide/become.html#become-network

【讨论】:

    猜你喜欢
    • 2021-09-03
    • 2018-09-20
    • 2013-11-07
    • 2011-05-31
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-25
    相关资源
    最近更新 更多