Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

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

 

Problem:

Description:

During execution of a Juniper.junos module or an Ansible core module for Junos OS, the Ansible control machine generates an error that junos-eznc is not installed. For example:

or

Cause

The Ansible Galaxy modules in the Juniper.junos role and certain Ansible core modules for Junos OS use the Juniper Networks Junos PyEZ Python library to perform operations on devices running Junos OS. This library must be installed on the Ansible control machine before executing the modules. In addition, the Juniper.junos modules introduced in Release 2.0.0 of Ansible for Junos OS require Junos PyEZ Release 2.1.7 or later on the Ansible control machine.

Solution

Install Junos PyEZ on the control machine and update any necessary environment variables. See https://github.com/Juniper/py-junos-eznc#installation for more information.

Note

If Ansible is run from inside a virtual environment, you must install Junos PyEZ inside the virtual environment, and you must specify the path to the Python interpreter inside the virtual environment by using the ansible_python_interpreter Ansible inventory variable.

To verify that Junos PyEZ is successfully installed on the control machine, launch the Python interactive shell and import the jnpr.junos package.

[user@ansible-cm ~]$ python

If the jnpr.junos package is successfully imported and there is no error message, then Junos PyEZ is installed on the Ansible control machine.