Module for interfacing to Junos devices.
salt.modules.junos.
call_rpc
(cmd=None, *args, **kwargs)¶This function executes the rpc provided as arguments on the junos device. The returned data can be stored in a file whose destination can be specified with 'dest' keyword in the arguments.
Usage:
salt 'device' junos.call_rpc 'get_config' '<configuration><system/></configuration>' terse=True
salt 'device' junos.call_rpc 'get-chassis-inventory' dest=/home/user/rpc_information.txt
salt.modules.junos.
cli
(command=None)¶Executes the CLI commands and reuturns the text output.
Usage:
salt 'device_name' junos.cli 'show version'
salt.modules.junos.
commit
()¶To commit the changes loaded in the candidate configuration.
Usage:
salt 'device_name' junos.commit
salt.modules.junos.
diff
()¶Gives the difference between the candidate and the current configuration.
Usage:
salt 'device_name' junos.diff
salt.modules.junos.
facts
()¶Displays the facts gathered during the connection.
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.
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
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 '/home/user/config.set' timeout=300
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 '/home/user/junos_image.tgz' reboot=True
salt.modules.junos.
ping
()¶To check the connection with the device
Usage:
salt 'device_name' junos.ping
salt.modules.junos.
rollback
()¶To rollback the last committed configuration changes
Usage:
salt 'device_name' junos.rollback
salt.modules.junos.
set_hostname
(hostname=None, commit_change=True)¶To set the name of the device.
Usage:
salt 'device_name' junos.set_hostname hostname=salt-device
salt.modules.junos.
shutdown
(time=0)¶Shuts down the device after the given time.
Usage:
salt 'device_name' junos.shutdown 10
salt.modules.junos.
zeroize
()¶Resets the device to default factory settings
Usage:
salt 'device_name' junos.zeroize