Ansible

Solve “[WARNING]: sftp transfer mechanism failed” in Ansible

I encountered the the error message while running an Ansible Playbook against Ubuntu 24.04 Linux machine: “[WARNING]: sftp transfer mechanism failed on [192.168.1.205]. Use ANSIBLE_DEBUG=1 to see detailed information“. To get extra information regarding the error, I enabled debug in ansible.

Original content from computingforgeeks.com - post 155453
export ANSIBLE_DEBUG=1

Then rerunning the playbook.

ansible-playbook playbook-name.yml

Get the exact version of ansible on your local system and try check against online pages if there is a known issue with it.

$ ansible --version
ansible [core 2.16.0]
  config file = None
  configured module search path = ['/Users/jkmutai/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/jkmutai/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.0 (main, Oct  2 2023, 12:03:24) [Clang 15.0.0 (clang-1500.0.40.1)] (/usr/local/Cellar/ansible/9.0.1/libexec/bin/python)
  jinja version = 3.1.2
  libyaml = True

There was not reported issue for my version.

On Debian based systems, installing openssh-sftp-server package will provide SFTP functionality. Make sure this package is installed on your remote Linux machine:

sudo apt install openssh-sftp-server

Next I opened SSH server configuration file on the remote machine:

sudo vim /etc/ssh/sshd_config

And commented below line.

#From 
Subsystem      sftp    /usr/lib/openssh/sftp-server
# To
#Subsystem      sftp    /usr/lib/openssh/sftp-server

I then added below to enable internal SFTP server within OpenSSH daemon.

Subsystem sftp internal-sftp

OpenSSH server must be restarted after the change.

sudo systemctl restart ssh

This change gave me a successful ansible execution.

Keep reading

Setup Sway Tiling Window Manager on Fedora with Waybar Desktop Setup Sway Tiling Window Manager on Fedora with Waybar Ansible + Proxmox: Automated VM Management Ansible Ansible + Proxmox: Automated VM Management Ansible Vault: Encrypting Secrets and Passwords Ansible Ansible Vault: Encrypting Secrets and Passwords Install IINA – Best video player for macOS macos Install IINA – Best video player for macOS Best Ansible Books to Master Automation in 2026 Ansible Best Ansible Books to Master Automation in 2026 Generate and Debug Ansible Playbooks with Claude Code AI Generate and Debug Ansible Playbooks with Claude Code

Leave a Comment

Press ESC to close