Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 month ago by AuroraCaptain814

Docker container error: missing rsync executable for ansible.posix.synchronize module

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I am trying to create a Docker image that can run Ansible playbooks using the ansible.posix.synchronize module.

I confirmed the module is installed with ansible-galaxy collection list, but when I run my playbook, Ansible cannot find the external executable (rsync) required by the module. The error message is as follows:

BASH
<10.16.29.75> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-1d52bc7yn/ansible-tmp-1738185054.6606917-31-140162884904275/AnsiballZ_synchronize.py && sleep 0' marios_spaghetti | <10.16.29.75> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-1d52bc7yn/ansible-tmp-1738185054.6606917-31-140162884904275/ > /dev/null 2>&1 && sleep 0' marios_spaghetti | The full traceback is: marios_spaghetti | File "/tmp/ansible_ansible.posix.synchronize_payload__jvn6z1c/ansible_ansible.posix.synchronize_payload.zip/ansible/module_utils/basic.py", line 1421, in get_bin_path marios_spaghetti | bin_path = get_bin_path(arg=arg, opt_dirs=opt_dirs) marios_spaghetti | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ marios_spaghetti | File "/tmp/ansible_ansible.posix.synchronize_payload__jvn6z1c/ansible_ansible.posix.synchronize_payload.zip/ansible/module_utils/common/process.py", line 44, in get_bin_path marios_spaghetti | raise ValueError('Failed to find required executable "%s" in paths: %s' % (arg, os.pathsep.join(paths))) marios_spaghetti | fatal: [airflowdev]: FAILED! => { marios_spaghetti | "changed": false, marios_spaghetti | "invocation": { marios_spaghetti | "module_args": { marios_spaghetti | "_local_rsync_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", marios_spaghetti | "_local_rsync_path": "rsync", marios_spaghetti | "_substitute_controller": false, marios_spaghetti | "archive": true, marios_spaghetti | "checksum": false, marios_spaghetti | "compress": true, marios_spaghetti | "copy_links": false, marios_spaghetti | "delay_updates": true, marios_spaghetti | "delete": true, marios_spaghetti | "dest": "infogrid@10.16.29.75:/home/infogrid/cp_test_ansible", marios_spaghetti | "dest_port": null, marios_spaghetti | "dirs": false, marios_spaghetti | "existing_only": false, marios_spaghetti | "group": null, marios_spaghetti | "link_dest": null, marios_spaghetti | "links": null, marios_spaghetti | "mode": "push", marios_spaghetti | "owner": null, marios_spaghetti | "partial": false, marios_spaghetti | "perms": null, marios_spaghetti | "private_key": null, marios_spaghetti | "recursive": true, marios_spaghetti | "rsync_opts": [], marios_spaghetti | "rsync_path": null, marios_spaghetti | "rsync_timeout": 0, marios_spaghetti | "set_remote_user": true, marios_spaghetti | "src": "/fake_dags", marios_spaghetti | "ssh_args": null, marios_spaghetti | "ssh_connection_multiplexing": false, marios_spaghetti | "times": null, marios_spaghetti | "verify_host": false marios_spaghetti | } marios_spaghetti | }, marios_spaghetti | "msg": "Failed to find required executable \"rsync\" in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" marios_spaghetti | }

Below are the configurations used:

Dockerfile:

DOCKERFILE
FROM ubuntu:latest RUN apt-get update RUN apt-get install -y python3 RUN apt-get install -y python3-pip RUN apt install -y openssh-client RUN apt install -y sshpass RUN apt install -y python3 ansible

Ansible playbook:

YAML
- name: fakedagdeployment hosts: airflowdev become: true tasks: - name: deploy fake dags ansible.posix.synchronize: src: /fake_dags dest: /home/infogrid/cp_test_ansible delete: true recursive: true

Docker Compose file:

DYAML
services: ansible_poc: container_name: marios_spaghetti environment: ANSIBLE_HOST_KEY_CHECKING: False image: ansible-poc command: ansible-playbook -vvv -i ./inventory/hosts.yml --user infogrid ./playbooks/fakedagdeploy.yml volumes: - ./fake_dags:/fake_dags - ./inventory:/inventory - ./playbooks:/playbooks

I would appreciate any insights on resolving the rsync dependency issue. Thank you for your help!

0

Comments 0

Answers 3

Views 67

3 Answers

Answer by StackOverflowTychoAI Agent 1 month ago

0

The error message indicates that the rsync executable is missing. The ansible.posix.synchronize module internally calls rsync, so even though the collection is installed, rsync itself must be present on the system running the playbook.

To fix this, update your Dockerfile to install rsync. For example:

DOCKERFILE
FROM ubuntu:latest RUN apt-get update && apt-get install -y python3 python3-pip \ openssh-client sshpass ansible rsync

By adding rsync (using apt-get install -y rsync) in your Dockerfile, the synchronize module will be able to locate the required binary. Also, if the target host (airflowdev) is a Docker container or remote machine, ensure rsync is installed there as well.

Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?

No comments yet.

Answer by LunarExplorer388 1 month ago

0

I made the assumption rsync was installed as a part of base ubuntu image and it is not, I solved the issue by adding this line to my image code

RUN apt-get install -y rsync

No comments yet.

Answer by CosmicWayfarer623 1 month ago

0

I have confirmed the module exists by running ansible-galaxy collection list

An Ansible module can be present, but it doesn't mean that its external dependencies are installed.

From the ansible.posix.synchronize documentation:

rsync must be installed on both the local and remote host.

Therefore you'll need to add

BASH
RUN apt-get install -y rsync

No comments yet.

Discussion

No comments yet.