salt.states.junos module

State modules to interact with Junos devices.

These modules call the corresponding execution modules. Refer to junos for further information.

salt.states.junos.cli(name)

Executes the CLI commands and reuturns the text output.

show version:
  junos.cli

name: the command to be executed on junos CLI.

salt.states.junos.commit(name)

Commits the changes loaded into the candidate configuration.

commit the changes:
  junos.commit

name: can be anything

salt.states.junos.diff(name)

Gets the difference between the candidate and the current configuration.

get the diff:
  junos.diff

name: can be anything

salt.states.junos.file_copy(name, dest=None)

Copies the file from the local device to the junos device.

/home/m2/info.txt:
  junos:
    - file_copy
    - dest: info_copy.txt

name: source path of the file.

dest: destination path where the file will be placed.

salt.states.junos.install_config(name, **kwargs)

Loads and commits the configuration provided.

/home/user/config.set:
  junos:
    - install_config
    - timeout: 100

name: path to the configuration file.

keyworded arguments taken by load fucntion of PyEZ

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.

/home/user/junos_image.tgz:
  junos:
    - install_os
    - timeout: 100
    - reboot: True

name: path to the image file.

kwargs: keyworded arguments to be given such as timeout, reboot etc

salt.states.junos.rollback(name)

Rollbacks the committed changes.

rollback the changes:
  junos.rollback

name: can be anything

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

name: the rpc to be executed.

args: other arguments as taken by rpc call of PyEZ

kwargs: keyworded arguments taken by rpc call of PyEZ

salt.states.junos.set_hostname(name, commit_changes=True)

Changes the hostname of the device.

device name:
  junos:
    - set_hostname
    - commit_changes: False

name: the name to be given to the device

commit_changes: whether to commit the changes

salt.states.junos.shutdown(name, time=0)

Shuts down the device.

shut the device:
  junos:
    - shutdown
    - time: 10

name: can be anything

time: time after which the system should shutdown(in seconds, default=0)

salt.states.junos.zeroize(name)

Resets the device to default factory settings.

reset my device:
  junos.zeroize

name: can be anything