sftp transfer mechanism failed on ansible

ansible Oct 9, 2022

Lately, I've been running into an issue with Ansible. My playbook runs kept running into the following issue.

[WARNING]: sftp transfer mechanism failed on [server-name]. Use ANSIBLE_DEBUG=1 to see detailed information

My research took me to the following Stack Overflow link where the synopsis is that you have to create an override with the ansible.cfg file.

[ssh_connection]
scp_if_ssh=True

However, the issue is the default location for the ansible.cfg file isn't easily found. Instead, the ansible configuration file can be used in the following contexts and will be processed in the following order:
ANSIBLE_CONFIG (an environment variable)

  • ansible.cfg (in the current ansible project directory)
  • .ansible.cfg (in the user home directory)
  • /etc/ansible/ansible.cfg (in the application directory

I chose to put it in the project directory because I can see myself using it for other contexts in the future

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.