ansible.builtin.junos_scp (v2.9.21) — module

Transfer files from or to remote devices running Junos

| "added in version" 2.5 of ansible.builtin"

Authors: Christian Giese (@GIC-de)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.21

Description

This module transfers files via SCP from or to remote devices running Junos.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# the required set of connection arguments have been purposely left off
# the examples for brevity
- name: upload local file to home directory on remote device
  junos_scp:
    src: test.tgz
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: upload local file to tmp directory on remote device
  junos_scp:
    src: test.tgz
    dest: /tmp/
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: download file from remote device
  junos_scp:
    src: test.tgz
    remote_src: true

Inputs

    
src:
    description:
    - The C(src) argument takes a single path, or a list of paths to be transferred. The
      argument C(recursive) must be C(true) to transfer directories.
    required: true

dest:
    default: .
    description:
    - The C(dest) argument specifies the path in which to receive the files.

provider:
    description:
    - B(Deprecated)
    - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli) or C(connection:
      netconf).'
    - For more information please see the L(Junos OS Platform Options guide, ../network/user_guide/platform_junos.html).
    - HORIZONTALLINE
    - A dict object containing connection details.
    suboptions:
      host:
        description:
        - Specifies the DNS host name or address for connecting to the remote device over
          the specified transport.  The value of host is used as the destination address
          for the transport.
        type: str
      password:
        description:
        - Specifies the password to use to authenticate the connection to the remote device.   This
          value is used to authenticate the SSH session. If the value is not specified
          in the task, the value of environment variable C(ANSIBLE_NET_PASSWORD) will
          be used instead.
        type: str
      port:
        description:
        - Specifies the port to use when building the connection to the remote device.  The
          port value will default to the well known SSH port of 22 (for C(transport=cli))
          or port 830 (for C(transport=netconf)) device.
        type: int
      ssh_keyfile:
        description:
        - Specifies the SSH key to use to authenticate the connection to the remote device.   This
          value is the path to the key used to authenticate the SSH session. If the value
          is not specified in the task, the value of environment variable C(ANSIBLE_NET_SSH_KEYFILE)
          will be used instead.
        type: path
      timeout:
        description:
        - Specifies the timeout in seconds for communicating with the network device for
          either connecting or sending commands.  If the timeout is exceeded before the
          operation is completed, the module will error.
        type: int
      transport:
        choices:
        - cli
        - netconf
        default: netconf
        description:
        - Configures the transport connection to use when connecting to the remote device.
        type: str
      username:
        description:
        - Configures the username to use to authenticate the connection to the remote
          device.  This value is used to authenticate the SSH session. If the value is
          not specified in the task, the value of environment variable C(ANSIBLE_NET_USERNAME)
          will be used instead.
        type: str
    type: dict

recursive:
    default: 'no'
    description:
    - The C(recursive) argument enables recursive transfer of files and directories.
    type: bool

remote_src:
    default: 'no'
    description:
    - The C(remote_src) argument enables the download of files (I(scp get)) from the remote
      device. The default behavior is to upload files (I(scp put)) to the remote device.
    type: bool

Outputs

changed:
  description: always true
  returned: always
  type: bool