Tasks

nornir_paramiko.plugins.tasks.paramiko_command(task, command)

Executes a command remotely on the host :type command: str :param command: The command to execute

Returns:

  • result (str): stderr or stdout

  • stdout (str): stdout

  • stderr (str): stderr

Return type:

Result object with the following attributes set

Raises:

nornir_paramiko.exceptions.CommandError – When there is a command error.

nornir_paramiko.plugins.tasks.paramiko_sftp(task, src, dst, action, dry_run=None, compare=True)

Transfer files from/to the device using sftp protocol

Parameters:
  • dry_run (Optional[bool]) – Whether to apply changes or not

  • src (str) – source file

  • dst (str) – destination

  • action (Literal['get', 'put']) – put, get.

  • compare (bool) – Compare the src and dst file using sha1sum. This requires the host to support SFTP.

Returns:

  • changed (bool):

  • files_changed (list): list of files that changed

Return type:

Result object with the following attributes set

Examples

Put README.md to /tmp/README.md:

nornir.run(
    files.sftp,
    action="put",
    src="README.md",
    dst="/tmp/README.md"
)