| 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.states.junos.cli(name, **kwargs)¶Executes the CLI commands and reuturns the text output.
show version:
junos.cli:
- format: xml
get software version of device:
junos.cli:
- name: show version
- format: text
- dest: /home/user/show_version.log
| Parameters: |
|
|---|
salt.states.junos.commit(name, **kwargs)¶Commits the changes loaded into the candidate configuration.
commit the changes:
junos.commit:
- confirm: 10
| Parameters: | Optional --
|
|---|
salt.states.junos.commit_check(name)¶Perform a commit check on the configuration.
perform commit check:
junos.commit_check
salt.states.junos.diff(name, d_id=0, **kwargs)¶Changed in version 3001.
Gets the difference between the candidate and the current configuration.
get the diff:
junos.diff:
- d_id: 10
| Parameters: | Optional --
|
|---|
salt.states.junos.file_copy(name, dest=None, **kwargs)¶Copies the file from the local device to the junos device.
/home/m2/info.txt:
junos.file_copy:
- dest: info_copy.txt
| Parameters: | Required --
|
|---|
salt.states.junos.get_table(name, table, table_file, **kwargs)¶New in version 3001.
Retrieve data from a Junos device using Tables/Views
get route details:
junos.get_table:
- table: RouteTable
- table_file: routes.yml
get interface details:
junos.get_table:
- table: EthPortTable
- table_file: ethport.yml
- table_args:
interface_name: ge-0/0/0
salt.states.junos.install_config(name, **kwargs)¶Loads and commits the configuration provided.
Install the mentioned config:
junos.install_config:
- name: salt://configs/interface.set
- timeout: 100
- diffs_file: '/var/log/diff'
Install the mentioned config:
junos.install_config:
- path: salt://configs/interface.set
- timeout: 100
- template_vars:
interface_name: lo0
description: Creating interface via SaltStack.
*.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 commandsSet to True if you want this file is to completely replace the
configuration file. Sets action to override
Note
This option cannot be used if format is "set".
True will set the load-config action to merge.
the default load-config action is 'replace' for xml/json/text configPath to the file where the diff (difference in old configuration and the committed configuration) will be stored.
Note
The file will be stored on the proxy minion. To push the files to the
master use cp.push.
salt.states.junos.install_os(name, **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.
salt://images/junos_image.tgz:
junos.install_os:
- timeout: 100
- reboot: True
| Parameters: |
|
|---|
salt.states.junos.load(name, **kwargs)¶Loads the configuration provided onto the junos device.
Install the mentioned config:
junos.load:
- name: salt://configs/interface.set
Install the mentioned config:
junos.load:
- name: salt://configs/interface.set
- template_vars:
interface_name: lo0
description: Creating interface via SaltStack.
Sample template:
set interfaces {{ interface_name }} unit 0
*.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.Set to True if you want this file is to completely replace the
configuration file.
Note
This option cannot be used if format is "set".
True will set the load-config action to merge.
the default load-config action is 'replace' for xml/json/text configsalt.states.junos.lock(name)¶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.
lock the config:
junos.lock
salt.states.junos.resultdecorator(function)¶salt.states.junos.rollback(name, d_id, **kwargs)¶Rollbacks the committed changes.
rollback the changes:
junos.rollback:
- id: 5
| Parameters: | Optional --
|
|---|
salt.states.junos.rpc(name, dest=None, format='xml', args=None, **kwargs)¶Executes the given rpc. The returned data can be stored in a file by specifying the destination path with dest as an argument
get-interface-information:
junos.rpc:
- dest: /home/user/rpc.log
- interface_name: lo0
fetch interface information with terse:
junos.rpc:
- name: get-interface-information
- terse: True
| Parameters: |
|
|---|
salt.states.junos.set_hostname(name, **kwargs)¶Changes the hostname of the device.
device_name:
junos.set_hostname:
- comment: "Host-name set via saltstack."
| Parameters: |
|
|---|
salt.states.junos.shutdown(name, **kwargs)¶Shuts down the device.
shut the device:
junos.shutdown:
- in_min: 10
| Parameters: | Optional --
|
|---|
salt.states.junos.unlock(name)¶Unlocks the candidate configuration.
unlock the config:
junos.unlock
salt.states.junos.zeroize(name)¶Resets the device to default factory settings.
reset my device:
junos.zeroize
name: can be anything
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 3004.1