Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Troubleshooting Ansible Errors When Configuring Devices Running Junos OS

 

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

Troubleshooting Configuration Timeout Errors

Problem:

Description: The playbook generates a TimeoutExpiredError error message and fails to update the device configuration.

Cause

The default time for a NETCONF RPC to time out is 30 seconds. Large configuration changes might exceed this value causing the operation to time out before the configuration can be uploaded and committed.

Solution

To accommodate configuration changes that might require a commit time that is longer than the default RPC timeout interval, set the juniper_junos_config timeout argument to an appropriate value and re-run the playbook.

Troubleshooting Configuration Lock Errors

Problem:

Description:

The playbook generates an error message indicating that the configuration cannot be locked. For example:

or

Cause

A configuration lock error can occur for the following reasons:

  • Another user has an exclusive lock on the configuration.

  • Another user made changes to the configuration database but has not yet committed the changes.

  • The user executing the Ansible module does not have permissions to configure the device.

Solution

The LockError message string usually indicates the root cause of the issue. If another user has an exclusive lock on the configuration or has modified the configuration, wait until the lock is released or the changes are committed, and execute the playbook again. If the cause of the issue is that the user does not have permissions to configure the device, either execute the playbook with a user who has the necessary permissions, or if appropriate, configure the device running Junos OS to give the current user the necessary permissions to make the changes.

Troubleshooting Configuration Change Errors

Problem:

Description:

The playbook generates a ConfigLoadError error message indicating that the configuration cannot be modified, because permission is denied.

Cause

This error message is generated when the user executing the Ansible module has permission to modify the configuration but does not have permission to alter the requested section of the configuration.

Solution

To solve this issue, either execute the playbook with a user who has the necessary permissions, or if appropriate, configure the device running Junos OS to give the current user the necessary permissions to make the changes.

Troubleshooting Commit Errors

Problem:

Description:

The juniper_junos_config module or the older junos_install_config module generates a CommitError error message indicating that the commit operation failed due to a configuration lock error.

Cause

A configuration lock error can occur for the reasons described in Troubleshooting Configuration Lock Errors. However, a configuration lock failed message might be generated as part of a CommitError instead of a LockError in the event that the task requests a commit check and a commit operation, and the device initiates the commit operation before the commit check operation releases the configuration lock.

Solution

To enable sufficient time for the device to complete the commit check operation and release the configuration lock before initiating the commit operation, set the juniper_junos_config or junos_install_config module’s check_commit_wait parameter to an appropriate value and re-run the playbook. The check_commit_wait value is the number of seconds to wait between the commit check and commit operations.

The following sample task waits five seconds between the commit check and commit operations: