Files¶
-
nornir.plugins.tasks.files.sftp(task: nornir.core.task.Task, src: str, dst: str, action: str, dry_run: Optional[bool] = None) → nornir.core.task.Result¶ Transfer files from/to the device using sftp protocol
Example:
nornir.run(files.sftp, action="put", src="README.md", dst="/tmp/README.md")
Parameters: - dry_run – Whether to apply changes or not
- src – source file
- dst – destination
- action –
put,get.
Returns: - changed (
bool): - files_changed (
list): list of files that changed
Return type: Result object with the following attributes set
-
nornir.plugins.tasks.files.write_file(task: nornir.core.task.Task, filename: str, content: str, append: bool = False, dry_run: Optional[bool] = None) → nornir.core.task.Result¶ Write contents to a file (locally)
Parameters: - dry_run – Whether to apply changes or not
- filename – file you want to write into
- content – content you want to write
- append – whether you want to replace the contents or append to it
Returns: - changed (
bool): - diff (
str): unified diff
Return type: Result object with the following attributes set