View Only
last person joined: yesterday 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Ansible and SCP

    Posted 11-06-2023 15:30

    I am trying to use Ansible to SCP a file to Juniper devices.  I had this working with a prior version of Ansible, but I received a new laptop that must have a newer version of Ansible and python and now the playbook fails, saying: "Connection type 'local' is not valid for 'junos_scp' module."  I tried looking up the requirements for the junos_scp module, but it appears to be deprecated.  What is the correct method to SCP file via Ansible?  Does someone have a working example?  Thanks.

  • 2.  RE: Ansible and SCP

    Posted 11-10-2023 08:46

    Take a look at


  • 3.  RE: Ansible and SCP

    Posted 11-10-2023 10:29

    This looks promising, but I am having issues.  Do you have this working with a Juniper switch?  Using paramiko, I get "replay attack on SSH warnings" and partial transfer.  I then loaded the optional ansible-pylibssh, and now I get "unable to connect to socket".  Thanks for your assistance.

  • 4.  RE: Ansible and SCP

    Posted 11-16-2023 10:31

    I was able to get this to work using paramiko (ansible_network_cli_ssh_type: paramiko), and increasing my command timeout (ansible_command_timeout: 600). 

    Thanks again for you suggestion!

  • 5.  RE: Ansible and SCP

    Posted 12-14-2023 13:34

    I'm using this with the ansible command module and delegating  to a local operational server and carry out the command with sshpass. 

    - name: scp os image to SRX firewall
    cmd: "sshpass -p {{srx_ansible_password}} scp -O {{OS_package_path}}{{OS_package}} {{srx_ansible_user}}@{{inventory_hostname}}:/var/tmp/{{OS_package}}"
    register: scp_copy_results
    no_log: true
    delegate_to: ops_server
    become: false