Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

适用于 Junos OS 的 Ansible 故障排除摘要

表 1 列出了使用 juniper.device Ansible 模块管理瞻博网络设备时可能遇到的一些常见错误。对于每个问题,该表都提供了一个参考,其中包含有关错误和解决问题的潜在解决方案的其他信息。但是,每个环境都是独一无二的,建议的解决方案可能并非在所有情况下都有效。

表 1:Ansible for Junos OS 错误
一般问题 示例错误 参考

Junos PyEZ
(junos-eznc) 库错误

  • "msg": "junos-eznc is required but does not appear to be installed. It can be installed using 'pip install junos-eznc'"

Ansible 模块的 Junos PyEZ (junos-eznc) 安装错误故障排除

Ansible 收集和模块解析错误

  • ERROR! couldn't resolve module/action 'module-name'. This often indicates a misspelling, missing collection, or incorrect module path.

  • ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

在管理 Junos 设备时排除 Ansible 收集和模块错误

外部连接插件错误
AttributeError: 'Connection'

(适用于 Ansible ansible-core 版本 >= 2.12.9)

  • AttributeError: 'Connection' object has no attribute 'nonetype'

未设置_sub_plugin触发错误的外部连接插件

无法访问主机

  • UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ", "unreachable": true}

排除连接失败、未知命令或未找到解释器错误

找不到模块解释器/未知命令

  • [ERROR]: Task failed: Action failed: The module interpreter '/path/to/bin/python' was not found.

  • unknown command: /bin/sh\r\n

排除连接失败、未知命令或未找到解释器错误

未知主机或地址错误

  • "msg": "Unable to make a PyEZ connection: ConnectUnknownHostError(dc1a.example.net)"

  • [WARNING]: Could not match supplied host pattern, ignoring: name

  • "msg": "[Errno -5] No address associated with hostname"

未知主机错误故障排除

连接被拒绝或套接字错误

  • "msg": "Unable to make a PyEZ connection: ConnectRefusedError(dc1a.example.net)"

  • "msg": "Could not open socket to hostname:830"

排除拒绝连接错误和套接字错误

主机网络操作系统错误

  • Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host

主机网络操作系统错误排解

身份验证错误

  • "msg": "Unable to make a PyEZ connection: ConnectAuthError(dc1a.example.net)"

  • "msg": "AuthenticationException('Authentication failed.')"

身份验证错误故障排除

缺少主机或sock_fd错误 (junos_package

  • [ERROR]: Task failed: You must provide either 'host' or 'sock_fd' value

为模块提供连接和身份验证参数

conn_type 错误

  • AttributeError: 'JuniperJunosModule' object has no attribute 'conn_type'

排除属性conn_type错误

配置超时错误
(TimeoutExpiredError)

  • ncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply

配置超时错误故障排除

配置锁定错误
(LockError)

  • "msg": "Unable to open the configuration in exclusive mode: LockError(severity: error, bad_element: None, message: configuration database modified)"

  • "msg": "Unable to open the configuration in exclusive mode: LockError(severity: error, bad_element: lock-configuration, message: permission denied)"

配置锁定错误故障排除

配置加载错误
(ConfigLoadError)

  • FAILED! => {"changed": false, "msg": "Failure loading the configuraton: ConfigLoadError(severity: error, bad_element: scripts, message: error: permission denied)"}

配置加载错误故障排除

配置提交错误
(CommitError)

  • FAILED! => {"changed": false, "msg": "Unable to commit configuration: CommitError(edit_path: None, bad_element: None, message: error: remote lock-configuration failed on re0\n\nnote: consider using 'commit synchronize force' to\nterminate remote edit sessions and force the commit)"}

提交错误故障排除