Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Troubleshoot Ansible Authentication Errors When Managing Junos Devices

The following sections outline authentication errors that you might encounter when using Ansible to manage devices running Junos OS and devices running Junos OS Evolved. These sections also present potential causes and solutions for each error.

Troubleshoot Authentication Errors

Problem

Description

During execution of a juniper.device module or a junipernetworks.junos module in the juniper.device collection, the Ansible control node generates a ConnectAuthError error or an AuthenticationException error for failed authentication. For example:

or

Cause

The Junos device might fail to authenticate the user for the following reasons:

  • The user does not have an account on the Junos device.

  • The user has an account with a text-based password configured on the Junos device, but the wrong password or no password is supplied for the user when executing the module.

  • The user has an account on the Junos device with SSH keys configured, but the SSH keys are inaccessible on either the device or the control node.

Solution

Ensure that the user executing the modules has a Junos OS login account on all target Junos devices. The account must have an SSH public/private keypair or text-based password configured. If the account uses SSH keys, verify that the user can access the keys.

Troubleshoot Attribute conn_type Errors

Problem

Description

During execution of a juniper.device module, the Ansible control node generates the following error:

Cause

Whereas the older, deprecated Juniper.junos modules supported using a provider dictionary to define connection and authentication parameters, the juniper.device modules do not support using a provider dictionary. If you reference a provider dictionary, the modules generate the aforementioned error.

Solution

For the juniper.device modules (excluding juniper.device.junos_* modules), if you supply connection and authentication parameters in the playbook’s play, you must define the parameters in the location appropriate for the Ansible connection.

  • For persistent connections (connection: juniper.device.pyez), define the parameters under the vars: section.

  • For local connections (connection: local), define the parameters either under the vars: section or as top-level module arguments.

The following playbook uses a persistent connection and defines the authentication parameter in the playbook's vars section.

The following playbook uses a local connection and defines the authentication parameter as a module argument.