Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Ansible for Junos OS Troubleshooting Summary

Table 1 lists some common errors that you might encounter when you use Ansible to manage Juniper Networks devices. For each issue, the table provides a reference that has additional information about the error and potential solutions to resolve the issue. However, every environment is unique, and a proposed solution might not work in all cases.

Table 1: Ansible for Junos OS Errors
General Issue Sample Errors Reference

Junos PyEZ
(junos-eznc) library errors

"msg": "junos-eznc (aka PyEZ) >= 2.6.0 is required for this module. However, junos-eznc does not appear to be currently installed."

Troubleshooting Junos PyEZ (junos-eznc) Install Errors for Ansible Modules

Ansible collection, role, and module resolution errors

ERROR! the role 'Juniper.junos' was not found in /usr/share/ansible/roles:/etc/ansible/roles ...

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

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

Troubleshooting Ansible Collection, Role, and Module Errors When Managing Devices Running Junos OS

Unreachable host

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

unknown command: /bin/sh\r\n

Troubleshooting Failed or Invalid Connection Errors

Unknown host

"msg": "Unable to make a PyEZ connection: ConnectUnknownHostError("

Troubleshooting Unknown Host Errors

Connection refused

"msg": "Unable to make a PyEZ connection: ConnectRefusedError("

Troubleshooting Refused Connection Errors

Authentication error

"msg": "Unable to make a PyEZ connection: ConnectAuthError("

Troubleshooting ConnectAuthError Issues

conn_type error

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

Troubleshooting Attribute conn_type Errors

Configuration timeout error

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

Troubleshooting Configuration Timeout Errors

Configuration lock error

"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)"

Troubleshooting Configuration Lock Errors

Configuration load error

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

Troubleshooting Configuration Load Errors

Configuration commit error

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)"}

Troubleshooting Commit Errors