file_copy¶
File put and get module
Synopsis¶
Copy file over SCP/FTP to and from a Juniper device
Module-specific Options¶
The following options may be specified for this module:
| parameter | type | required | default | choices | comments |
|---|---|---|---|---|---|
| action |
str | yes | put, get |
Type of operation to execute, currently only support get and put
|
|
| checksum |
bool | no | True |
Validate the file using MD5 algorithm check
|
|
| file |
str | yes |
Name of the file to copy to/from the remote device
|
||
| local_dir |
str | yes |
path of the local directory where the file is located or needs to be copied to
|
||
| protocol |
str | no | scp | scp, ftp |
Set the protocol to transfer the file
|
| remote_dir |
str | yes |
path of the directory on the remote device where the file is located or needs to be copied to
|
||
| transfer_filename |
str | no |
Name of the transfer file to copy to/from the remote device. If not specified, the value of file is used.
|
Examples¶
---
- name: Examples of juniper_device_file_copy
hosts: all
connection: local
gather_facts: false
tasks:
- name: Copy a log file on a remote device locally
juniper.device.file_copy:
protocol: scp
remote_dir: /var/log
local_dir: /tmp
action: get
checksum: true
file: log.txt
- name: Copy a local file into /var/tmp on the remote device
juniper.device.file_copy:
protocol: ftp
remote_dir: /var/tmp
local_dir: /tmp
action: put
checksum: false
file: license.txt
- name: Copy a local file to the remote device with a different filename
juniper.device.file_copy:
protocol: scp
remote_dir: /var/tmp
local_dir: /tmp
action: put
file: license.txt
transfer_filename: license_copy.txt
Status¶
This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.