Skip to content

network_restore.yml fails with 'sshpass: command not found' when restore_mode is overwrite #71

@ericcames

Description

@ericcames

Summary

Running playbooks/network_restore.yml with restore_mode: overwrite on IOS devices fails with:

changed: true
stdout: ''
stderr: '/bin/sh: line 1: sshpass: command not found'
rc: 127
cmd: >
  sshpass -p "..." scp -O -o StrictHostKeyChecking=no
  /backup/<date>/cisco.txt
  admin@cisco:'flash:<date>-cisco.txt'

Root Cause

roles/restore/tasks/ios/overwrite.yml uses sshpass to authenticate the SCP transfer to the Cisco device when ansible_password is set. The task is delegated to backup-server, so sshpass must be installed on the backup-server — not on the Ansible control node. This dependency is undocumented.

Steps to Reproduce

  1. Set restore_mode: overwrite (or rely on the default, which resolves to overwrite per ios.yml)
  2. Run ansible-playbook playbooks/network_restore.yml -e rollback_date=<date>
  3. Observe failure at the "Copy file over to flash on network device using SCP" task

Expected Behavior

Either:

  • sshpass is listed as a prerequisite for the backup-server in the README, or
  • The playbook checks for sshpass and fails with a clear message before attempting the SCP

Fix

Install sshpass on the backup-server:

sudo dnf install sshpass   # RHEL/Fedora
sudo apt install sshpass   # Debian/Ubuntu

And document this as a prerequisite in the repo README or role README (roles/restore/README.md).

Environment

  • Ansible network_os: cisco.ios
  • restore_mode: overwrite
  • Failing task: roles/restore/tasks/ios/overwrite.yml — "Copy file over to flash on network device using SCP"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions