Dari beberapa server yang di test

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

sftp gagal ansible

Coba ngikuti saran dari errornya, aktifin debug, ditambah -vvv

$ ansible all -l DB03 -vvv -m shell -a 'uptime'
# output
...
...
<DB03> PUT /home/jaranguda/.ansible/tmp/ansible-local-3599jdi8zyg2/tmpfmi8111j TO /root/.ansible/tmp/ansible-tmp-1585651877.9100487-550434098817/AnsiballZ_command.py
<DB03> SSH: EXEC sshpass -d10 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/home/jaranguda/.ansible/cp/84674e94fb '[DB03]'
 [WARNING]: sftp transfer mechanism failed on [DB03]. Use ANSIBLE_DEBUG=1 to see detailed information
...
...

masalahnya ada sewaktu melakukann sftp dengan sshpass. Saya coba cek file konfigurasi ssh server di /etc/ssh/sshd_config, ada bagian yang ngurusin sftp

Subsystem   sftp    /usr/libexec/openssh/sftp-server

file /usr/libexec/openssh/sftp-server tidak ada di Debian/Ubuntu, hanya ada di CentOS/Fedora/RHEL. Ganti menjadi

Subsystem sftp /usr/lib/openssh/sftp-server

restart SSH Server

systemctl restart sshd

Jalanin kembali ansible

$ ansible all -l DB03 -m shell -a 'uptime'
# output
DB03 | CHANGED | rc=0 >>
 18:27:07 up 5 days,  7:16,  2 users,  load average: 0.03, 0.01, 0.00

Leave a comment

Your email address will not be published. Required fields are marked *