Contents:
Author: | Jeremy Schulman, Juniper Networks |
---|
New in version 1.0.0.
Shut down (power off) or reboot a device running Junos OS. This includes all Routing Engines in a Virtual Chassis or a dual Routing Engine system. This is equivalent to executing either the Junos OS request system power-off or request system reboot operational command.
parameter | required | default | choices | comments |
---|---|---|---|---|
host | yes | Set to {{ inventory_hostname }} | ||
passwd | no | assumes ssh-key active | Login password | |
port | no | 830 | TCP port number to use when connecting to the device | |
reboot | no |
|
If set to yes, then the device is rebooted rather than powered off. | |
shutdown | yes | None | Safety mechanism. You MUST set this to 'shutdown'. | |
user | no | $USER | Login username |
Note
Requires junos-eznc >= 1.1.0
Author: | Jeremy Schulman, Juniper Networks |
---|
New in version 1.0.0.
Retrieve facts for a device running Junos OS, which includes information such as the serial number, product model, and Junos OS version. The module supports using both NETCONF and CONSOLE-based retrieval and returns the information as a JSON dictionary. The information is similar to facts gathered by other IT frameworks.
parameter | required | default | choices | comments |
---|---|---|---|---|
console | no | None | CONSOLE port, per the netconify utility | |
host | yes | Set to {{ inventory_hostname }} | ||
logfile | no | None | Path on the local server where the progress status is logged for debugging purposes. This option is used only with the console option. | |
passwd | no | assumes ssh-key active | Login password | |
port | no | 830 | TCP port number to use when connecting to the device | |
savedir | no | $CWD | Path to the local server directory where device facts and inventory files will be stored. This option is used only with the console option. Refer to the netconify utility for details. | |
user | no | $USER | Login username |
Note
Requires junos-eznc >= 1.1.0
Note
Requires junos-netconify >= 1.0.0, when using the console option
# retrieve facts using NETCONF, assumes ssh-keys
- junos_get_facts: host={{ inventory_hostname }}
register: junos
# retrieve facts using CONSOLE, assumes Amnesiac system
# root login, no password
- junos_get_facts:
host={{ inventory_hostname }}
user=root
console="--telnet={{TERMSERV}},{{TERMSERVPORT}}"
savedir=/usr/local/junos/inventory
register: junos
# access the facts
- name: version
debug: msg="{{ junos.facts.version }}"
Author: | Jeremy Schulman, Juniper Networks |
---|
New in version 1.0.0.
Execute the Junos OS request system zeroize command to remove all configuration information on the Routing Engines and reset all key values on a device running Junos OS. The command removes all data files, including customized configuration and log files, by unlinking the files from their directories. The command also removes all user-created files from the system including all plain-text passwords, secrets, and private keys for SSH, local encryption, local authentication, IPsec, RADIUS, TACACS+, and SNMP. This command reboots the device and sets it to the factory default configuration. After the reboot, you must log in through the console as root in order to access the device.
parameter | required | default | choices | comments |
---|---|---|---|---|
console | no | None | SERIAL or TERMINAL-SERVER port setting, per use with the netconify utility | |
host | no | Set to {{ inventory_hostname }} | ||
logfile | no | None | Path on the local server where the progress status is logged for debugging purposes | |
passwd | no | assumes ssh-key active | Login password | |
port | no | 830 | TCP port number to use when connecting to the device | |
user | no | $USER | Login username | |
zeroize | yes | None | Safety mechanism. You MUST set this to 'zeroize'. |
Note
Requires junos-eznc >= 1.1.0
Note
Requires junos-netconify >= 1.0.0, when using the console option
Author: | Jeremy Schulman, Juniper Networks |
---|
New in version 1.0.0.
Load a complete Junos OS configuration (overwrite) or merge a configuration snippet onto a device running Junos OS and commit it. The default behavior is to perform a load merge operation (overwrite=’no’). This module performs an atomic lock/edit/unlock. If the process fails at any step, then all configuration changes are discarded. You can load the configuration using either NETCONF or the CONSOLE port. Specify the console option to use the CONSOLE port. You provide the configuration data in a file. Supported formats when using NETCONF include ASCII text, Junos XML elements, and Junos OS set commands. Configurations performed through the console must only use ASCII text formatting.
parameter | required | default | choices | comments |
---|---|---|---|---|
comment | no | None | Provide a comment to the commit of the configuration | |
console | no | None | Port configuration, per the netconify utility | |
diffs_file | no | None | Path to the file where any diffs will be written | |
file | yes | Path to the file containing the Junos OS configuration data. If the file has a *.conf extension, the content is treated as text format. If the file has a *.xml extension, the content is treated as XML format. If the file has a *.set extension, the content is treated as Junos OS set commands. |
||
host | yes | Set to {{ inventory_hostname }} | ||
logfile | no | None | Path on the local server where the progress status is logged for debugging purposes | |
overwrite | no |
|
Specify whether the configuration file completely replaces the existing configuration. | |
passwd | no | assumes ssh-key active | Login password | |
port | no | 830 | TCP port number to use when connecting to the device | |
savedir | no | None | Path to the local server directory where device facts and inventory files will be stored. This option is used only with the console option. Refer to the netconify utility for details. | |
timeout | no | 0 | Extend the NETCONF RPC timeout beyond the default value of 30 seconds. Set this value to accommodate configuration changes (commits) that might take longer than the default timeout interval. | |
user | no | $USER | Login username |
Note
Requires junos-eznc >= 1.1.0
Note
Requires junos-netconify >= 1.0.0, when using the console option
# load merge a change to the Junos OS configuration using NETCONF
- junos_install_config:
host={{ inventory_hostname }}
file=banner.conf
# load overwrite a new Junos OS configuration using the CONSOLE port
- junos_install_config:
host={{ inventory_hostname }}
console="--telnet={{TERMSERV}},{{TERMSERV_PORT}}"
file=default_new_switch.conf
overwrite=yes
# load merge a change to the Junos OS configuration using NETCONF and supplying a commit log message
- junos_install_config:
host={{ inventory_hostname }}
file=banner.conf
comment="configured by ansible"
Author: | Jeremy Schulman, Juniper Networks |
---|
New in version 1.0.0.
Install a Junos OS image on one or more Routing Engines. This module supports installations on single Routing Engine devices, MX Series routers with dual Routing Engines, and EX Series switches in a non-mixed Virtual Chassis. This action is equivalent to performing the Junos OS request system software add operational command. If the existing Junos OS version matches the desired version, no action is performed, and the “changed” attribute reports False. If the existing version does not match, then the module performs the following actions (1) Computes the MD5 checksum of the package located on the server. (2) Copies the Junos OS software package to the device running Junos OS. (3) Computes the MD5 checksum on the device running Junos OS and compares the two. (4) Installs the Junos OS software package. (5) Reboots the device (default). Running the module in check mode reports whether the current Junos OS version matches the desired version.
parameter | required | default | choices | comments |
---|---|---|---|---|
host | yes | Set to {{ inventory_hostname }} | ||
logfile | no | None | Path on the local server where the progress status is logged for debugging purposes | |
no_copy | no |
|
Installer need to be copied or not on the device. | |
package | yes | Absolute path on the local server to the Junos OS software package | ||
passwd | no | assumes ssh-key active | Login password | |
port | no | 830 | TCP port number to use when connecting to the device | |
reboot | no | True |
|
If set to yes, the device reboots after the installation completes. |
reboot_pause | no | 10 | Amount of time in seconds to wait after the reboot is issued | |
user | no | $USER | Login username | |
version | yes | Junos OS version string as it would be reported by the show version command |
Note
Requires py-junos-eznc >= 1.1.0