Synchronize from control machine to remote host not working

SUMMARY
ISSUE TYPE
  • Bug Report / Issue workaround
- hosts: somehost
tasks:
- name: Synchronize
synchronize:
src: README.md
dest: /tmp/

COMPONENT NAME

synchronize

ANSIBLE VERSION

ansible 2.7.10

CONFIGURATION

OS / ENVIRONMENT

Linux

STEPS TO REPRODUCE

- hosts: somehost
tasks:
- name: Synchronize
synchronize:
src: README.md
dest: /tmp/

EXPECTED RESULTS

I’d file to be syncrhonize. If I execute any command on the remote host it works

ACTUAL RESULTS

task path: xxx.yml:10
fatal: [somehost]: FAILED! => {}

MSG:

Invalid shell type specified (bash), or the plugin for that shell type is missing.

I’d like to be able to synchronize from the control machine to the host, but I’m getting the aforementioned error. One thing that “works” is modifying the global ansible.cfg not to use shell, but this is not an option since it directly impacts all my existing scripts. Is there a way to either execute synchronize from controller to remote using bash or to specify the shell for that particular command? Somthing like shell: ‘sh’.

Also, I’m curious as to why the error. It only happens when synchronizing between controller and host. Between remote hosts it does not fail.

Thanks

It looks like DEFAULT_EXECUTABLE is set to bash. Since there is no bash shell plugin, this fails. Valid shell plugins are listed here.

The DEFAULT_EXECUTABLE setting controls the shell environment Ansible’s command is run under on the remote host. It does not affect scripts run via the script module.

@Sam Still, why is it that only synchronize from controller to host is failing? Same command between hosts works perfectly, as well as other commands: copy, shell…

Is there a workaround that does not involve changing a global variable for Ansible, which could affect preexisting scripts?

Things should work properly with the default config options. Has DEFAULT_EXECUTABLE been changed? What’s the output of ansible-config dump --only-changed?

synchronize does a lot of things in the action plugin that are very atypical.

DEFAULT_EXECUTABLE is only changed with the ansible.cfg to /bin/bash, but again this cannot be reverted since it affects the rest of the scripts