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 the juniper.device Ansible modules 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 is required but does not appear to be installed. It can be installed using 'pip install junos-eznc'"

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

Ansible collection and module resolution errors

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

Troubleshoot Ansible Collection 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}

Troubleshoot Failed Connection, Unknown Command, or Interpreter Not Found Errors

Module interpreter not found / unknown command

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

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

Troubleshoot Failed Connection, Unknown Command, or Interpreter Not Found Errors

Unknown host or address errors

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

Troubleshoot Unknown Host Errors

Connection refused or socket error

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

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

Troubleshoot Refused Connection Errors and Socket Errors

Host network OS error

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

Troubleshoot Host Network OS Errors

Authentication error

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

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

Troubleshoot Authentication Errors

Missing host or sock_fd error (junos_package)

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

Providing Connection and Authentication Parameters for the Module

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