Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Troubleshoot Ansible Collection and Module Errors When Managing Junos Devices

The following sections discuss errors that you might encounter when using the juniper.device Ansible collection to manage devices running Junos OS and devices running Junos OS Evolved.

Problem

Description

During execution of an Ansible playbook, the control node generates an error that it could not resolve a juniper.device module or junipernetworks.junos module or that no action was detected in the task. For example:

Cause

The Ansible control node cannot locate the juniper.device collection and associated modules. Starting in juniper.device Release 2.0.0, the collection includes the junipernetworks.junos modules in addition to the original juniper.device modules.

Solution

The juniper.device collection is hosted on the Ansible Galaxy website. In order to use the modules in the collection, you must install the collection on the Ansible control node and also reference it in your playbook.

To install the juniper.device collection on the Ansible control node, execute the ansible-galaxy collection install command, and specify juniper.device.

Note:

If you do not install the collection in the default location, you might need to define the path to it in your Ansible setup. For more information about installing collections and specifying the path, see the official Ansible documentation.

To use the modules in the juniper.device collection, reference the fully qualified collection name when you execute a module. You must also define the appropriate connection and network OS variables for the module set that you use. You can define the variables in different locations, for example, in your inventory file, in your host or group variable files, in your playbook, or as command-line arguments. For more information about the juniper.device module sets, see Understanding the Ansible for Junos OS Collections and Modules.

The following example playbook references the given inventory file and executes the juniper.device.facts module.

If you are using the junipernetworks.junos modules from the merged juniper.device collection and your playbook still references the junipernetworks.junos namespace:

  • In your playbook, update the fully qualified collection name to use juniper.device.

  • In your inventory file, set ansible_network_os to juniper.device.junos.

The following playbook references the given inventory file and executes the juniper.device.junos_facts module.

Note: To continue using playbooks that reference the junipernetworks.junos namespace, you can install both the juniper.device and junipernetworks.junos collections. However, you still need to update the Ansible network OS variable in your inventory file.