Module to interact with Junos devices.
maturity: | new |
---|---|
dependencies: | junos-eznc, jxmlease |
Note
Those who wish to use junos-eznc (PyEZ) version >= 2.1.0, must use the latest salt code from github until the next release.
Refer to junos
for information on connecting to junos proxy.
salt.modules.junos.
cli
(command=None, format='text', **kwargs)¶Executes the CLI commands and returns the output in specified format. (default is text) The ouput can also be stored in a file.
Usage:
salt 'device_name' junos.cli 'show system commit'
salt 'device_name' junos.cli 'show version' dev_timeout=40
salt 'device_name' junos.cli 'show system alarms' 'xml' dest=/home/user/cli_output.txt
Parameters: |
|
---|
salt.modules.junos.
commit
(**kwargs)¶To commit the changes loaded in the candidate configuration.
Usage:
salt 'device_name' junos.commit comment='Commiting via saltstack' detail=True
salt 'device_name' junos.commit dev_timeout=60 confirm=10
salt 'device_name' junos.commit sync=True dev_timeout=90
Parameters: | Optional --
|
---|
salt.modules.junos.
commit_check
()¶Perform a commit check on the configuration.
Usage:
salt 'device_name' junos.commit_check
salt.modules.junos.
diff
(id=0)¶Gives the difference between the candidate and the current configuration.
Usage:
salt 'device_name' junos.diff 3
Parameters: | Optional --
|
---|
salt.modules.junos.
facts
()¶Displays the facts gathered during the connection. These facts are also stored in Salt grains.
Usage:
salt 'device_name' junos.facts
salt.modules.junos.
facts_refresh
()¶Reload the facts dictionary from the device. Usually only needed if, the device configuration is changed by some other actor. This function will also refresh the facts stored in the salt grains.
Usage:
salt 'device_name' junos.facts_refresh
salt.modules.junos.
file_copy
(src=None, dest=None)¶Copies the file from the local device to the junos device.
Usage:
salt 'device_name' junos.file_copy /home/m2/info.txt info_copy.txt
Parameters: | Required --
|
---|
salt.modules.junos.
install_config
(path=None, **kwargs)¶Installs the given configuration file into the candidate configuration. Commits the changes if the commit checks or throws an error.
Usage:
salt 'device_name' junos.install_config 'salt://production/network/routers/config.set'
salt 'device_name' junos.install_config 'salt://templates/replace_config.conf' replace=True comment='Committed via SaltStack'
salt 'device_name' junos.install_config 'salt://my_new_configuration.conf' dev_timeout=300 diffs_file='/salt/confs/old_config.conf' overwrite=True
salt 'device_name' junos.install_config 'salt://syslog_template.conf' template_vars='{"syslog_host": "10.180.222.7"}'
Parameters: |
|
---|
salt.modules.junos.
install_os
(path=None, **kwargs)¶Installs the given image on the device. After the installation is complete the device is rebooted, if reboot=True is given as a keyworded argument.
Usage:
salt 'device_name' junos.install_os 'salt://images/junos_image.tgz' reboot=True
salt 'device_name' junos.install_os 'salt://junos_16_1.tgz' dev_timeout=300
Parameters: |
|
---|
salt.modules.junos.
load
(path=None, **kwargs)¶Loads the configuration from the file provided onto the device.
Usage:
salt 'device_name' junos.load 'salt://production/network/routers/config.set'
salt 'device_name' junos.load 'salt://templates/replace_config.conf' replace=True
salt 'device_name' junos.load 'salt://my_new_configuration.conf' overwrite=True
salt 'device_name' junos.load 'salt://syslog_template.conf' template_vars='{"syslog_host": "10.180.222.7"}'
Parameters: |
|
---|
salt.modules.junos.
lock
()¶Attempts an exclusive lock on the candidate configuration. This is a non-blocking call.
Note
Any user who wishes to use lock, must necessarily unlock the
configuration too. Ensure unlock
is called in the same orchestration run in which the lock is called.
Usage:
salt 'device_name' junos.lock
salt.modules.junos.
ping
(dest_ip=None, **kwargs)¶To send ping RPC to a device.
Usage:
salt 'device_name' junos.ping '8.8.8.8' count=5
salt 'device_name' junos.ping '8.8.8.8' ttl=1 rapid=True
Parameters: |
|
---|
salt.modules.junos.
rollback
(id=0, **kwargs)¶To rollback the last committed configuration changes and commit the same.
Usage:
salt 'device_name' junos.rollback 10
Parameters: | Optional --
|
---|
salt.modules.junos.
rpc
(cmd=None, dest=None, format='xml', **kwargs)¶This function executes the rpc provided as arguments on the junos device. The returned data can be stored in a file.
Usage:
salt 'device' junos.rpc 'get_config' '/var/log/config.txt' 'text' filter='<configuration><system/></configuration>'
salt 'device' junos.rpc 'get-interface-information' '/home/user/interface.xml' interface_name='lo0' terse=True
salt 'device' junos.rpc 'get-chassis-inventory'
Parameters: |
|
---|
salt.modules.junos.
set_hostname
(hostname=None, **kwargs)¶To set the name of the device.
Usage:
salt 'device_name' junos.set_hostname salt-device
Parameters: |
|
---|
salt.modules.junos.
shutdown
(**kwargs)¶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.
Usage:
salt 'device_name' junos.shutdown reboot=True
salt 'device_name' junos.shutdown shutdown=True in_min=10
salt 'device_name' junos.shutdown shutdown=True
Parameters: | Optional --
|
---|
salt.modules.junos.
unlock
()¶Unlocks the candidate configuration.
Usage:
salt 'device_name' junos.unlock
salt.modules.junos.
zeroize
()¶Resets the device to default factory settings
Usage:
salt 'device_name' junos.zeroize
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 2017.7.2