Release 2.0.0
Summary
This release is a major rewrite of the modules in this Juniper.junos role. This release offers several new features and bug fixes over previous releases, yet it still maintains backwards compatibility with playbooks written to previous releases of the Juniper.junos role. The following sections highlight some of the changes in this release.
Important Installation Note
The ansible-galaxy install command does not support a smooth upgrade from previous releases to this release. Therefore, you must first remove any previous versions of the Juniper.junos role by executing:
sudo ansible-galaxy remove Juniper.junos
Once previous versions have been removed, the current version of the Juniper.junos role may be installed with:
sudo ansible-galaxy install Juniper.junos
New Features
Modules renamed and re-organized.
Ansible added core modules for managing Junos devices in Ansible release 2.1. Since that time, there's been a lot of confusion between the Ansible-provided and supported modules in Ansible core and the Juniper-provided and supported modules in this Juniper.junos role. Part of this confusion was due to the similar names (and functionality) between the two sets of modules. Module renaming helps distinguish between the two sets of modules by:
- The new names for modules in this
Juniper.junosrole name all start with the prefixjuniper_junos_to indicate that the module is part of theJuniper.junosrole, and that the module is written and supported by Juniper. - Removes the direct naming conflict which existed with the
junos_rpcmodule. - Removes verbs such as
getandinstallfrom the module names in order to better follow Ansible best practices. - Removes the
climisnomer from thejunos_climodule by renaming it tojuniper_junos_command. The new name better indicates the module uses the NETCONF<command>RPC to execute the equivalent of a CLI command. - Consolidates multiple modules which deal with the same component (such as the configuration or system) into a single module per component.
NOTE
If a playbook worked with a prior version of the Juniper.junos role, it should continue to work on the current version without requiring modifications to the playbook. However, these older module and argument names are no longer present in the current documentation. You may reference previous module and argument names by referring directly to the 1.4.3 version of the Juniper.junos role documentation.
The following table provides a mapping between new and old module names:
| New Module Name | Old Module Name | New Arguments/Values Required to Mimic Old Module Behavior |
|---|---|---|
juniper_junos_command |
junos_cli |
|
juniper_junos_config |
junos_commit |
commit=True, diff=False, check=False |
juniper_junos_config |
junos_get_config |
retrieve="candidate" |
juniper_junos_config |
junos_install_config |
load="merge|update|replace|override" |
juniper_junos_config |
junos_rollback |
rollback=<value> |
juniper_junos_facts |
junos_get_facts |
|
juniper_junos_jsnapy |
junos_jsnapy |
|
juniper_junos_ping |
junos_ping |
|
juniper_junos_pmtud |
junos_pmtud |
|
juniper_junos_rpc |
junos_rpc |
|
juniper_junos_software |
junos_install_os |
|
juniper_junos_srx_cluster |
junos_srx_cluster |
|
juniper_junos_system |
junos_shutdown |
action="shutdown" or action="off" or action="reboot" |
juniper_junos_system |
junos_zeroize |
state="zeroize" |
juniper_junos_table |
junos_get_table |
Enhanced Connection-related Module Arguments (common for all modules)
- The
hostargument now defaults to{{ inventory_hostname }}. This means thehostargument is no longer required unless connecting to a Junos device through a console server. - Aliases have been added for several connection arguments to support compatibility with the argument names used by the core Ansible modules for Junos. Specifically:
- The
hostargument may now be alternatively specified using thehostnameoripargument aliases. - The
userargument may now be alternatively specified using theusernameargument alias. - The
passwdargument may now be alternatively specified using thepasswordargument alias. - The
ssh_private_key_fileargument may now be alternatively specified using thessh_keyfileargument alias.
- The
- The algorithm for selecting the default value of the
user,passwd, andssh_private_key_filearguments has been enhanced. In many cases, this means these parameters no longer need to be specified in each task. See the module documentation for details on the default values for these arguments. - The algorithm for selecting the default value of the
user,passwd, andssh_private_key_filearguments is compatible with Ansible Tower. - All connection-related arguments may now be, optionally, specified as sub-arguments of a
providerargument. This allows connection-related parameters to be specified in the same format used by the core Ansible modules for Junos. - All modules support a common set of connection-related arguments using a common library of code. This ensures the connection-related arguments behave consistently across all modules in the
Juniper.junosrole.
Enhanced Logging (common for all modules)
- All modules in the
Juniper.junosrole support a common set of logging arguments. - When the
logdirorlogfileoption is specified, the following messages are logged:- By default, messages at level WARNING or higher are logged.
- If the
-vor--verbosecommand-line options to theansible-playbookcommand are specified, messages at level INFO or higher are logged. - If the
-vv(or more verbose) command-line option to theansible-playbookcommand is specified, or theANSIBLE_DEBUGenvironment variable is set, then messages at level DEBUG or higher are logged.
juniper_junos_command Module
- The output of the command is available in the module's return value. It does not have to be saved to a file.
- For
xmlandjsonformat types, the output of the command is available as both an unparsed string and a parsed data structure. - Supports a list of commands to execute, rather than just a single command.
juniper_junos_config Module
- Any combination of loading or rolling back, checking, diffing, retrieving, and committing the configuration of a Junos device can now be performed in a single task.
- Configurations may be loaded from local filesystem of a Junos device or a remote URL using the
urlargument. - Configurations may be loaded directly from a rendered Jinja2 template using the
templateandvarsarguments. - Configurations may be loaded directly from a list of strings using the
linesargument. - Configurations may be loaded using
exclusivemode (the default) orprivatemode. - The candidate or committed configurations can be retrieved from the device.
- The retrieved configuration is available in the module's return value.
- Ability to ignore warnings.
juniper_junos_facts Module
- Acts as an official fact plugin so that facts are registered under the
junoshostvar. - Supports optionally retrieving the committed configuration as a fact.
juniper_junos_rpc Module
- The output of the RPC is available in the module's return value. It does not have to be saved to a file.
- For
xmlandjsonformat types, the output of the RPC is available as both an unparsed string and a parsed data structure. - Supports a list of RPCs to execute, rather than just a single RPC.
juniper_junos_software Module
- Support ISSU / NSSU.
- Support timeouts for the various stages of the software install process.
- Support the ability to disable cleanfs.
juniper_junos_system Module
- Support a
rollback rescueequivalent. - When performing a rollback, return config diffs in the response data structure.
Maintainability
Verified functionality with Ansible releases 2.1 to 2.4
Console connectivity to Junos devices is now provided by PyEZ rather than the Netconify library
- This ensures that all modules support connecting to the Junos device via console.
- The Netconify library is no longer a required package.
Better error handling of missing required libraries or unmet minimum versions.
Bugs Fixed
junos_shutdown - XMLSyntaxError' object has no attribute 'rsp #243
get_table - rpc timeout #242
'junos_install_os' fails without 'logfile' parameter #246
junos_install_os with NSSU get exceptions #244
junos_install_os fails to execute on a SRX320 #227
###"Uncaught exception - please report: Type 'str' cannot be serialized." #137