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

Troubleshoot 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.

Troubleshoot Ansible Collection, Role, and Module Errors When Managing Junos Devices

External connection plugins error
(AttributeError: 'Connection')

(Occurs for Ansible ansible-core version >=  2.12.9.)

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

External connection plugins that do not set _sub_plugin trigger errors

Unreachable host

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

unknown command: /bin/sh\r\n

Troubleshoot Failed or Invalid Connection Errors

Unknown host
(ConnectUnknownHostError)

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

Troubleshoot Unknown Host Errors

Connection refused
(ConnectRefusedError)

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

Troubleshoot Refused Connection Errors

Authentication error
(ConnectAuthError)

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

Troubleshoot ConnectAuthError Issues

conn_type error

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

Troubleshoot Attribute conn_type Errors

Configuration timeout error
(TimeoutExpiredError)

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

Troubleshoot Configuration Timeout Errors

Configuration lock error
(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)"

Troubleshoot Configuration Lock Errors

Configuration load error
(ConfigLoadError)

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

Troubleshoot Configuration Load Errors

Configuration commit error
(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)"}

Troubleshoot Commit Errors