1
- hosts: host1
  remote_user: root
  tasks:
   - synchronize:
           src: /etc/httpd
           dest: /mytestfile

Iam getting the following error.Could anyone help

PLAY [host1] *******************************************************************

TASK [Gathering Facts] *********************************************************
ok: [13.71.122.117]

TASK [synchronize] *************************************************************
fatal: [13.71.122.117]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find required executable rsync in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin"}
        to retry, use: --limit @/ansible/hai_yaml.retry

PLAY RECAP *********************************************************************
13.71.122.117              : ok=1    changed=0    unreachable=0    failed=1
1
  • 2
    rsync is not installed ... at least not in the given directories. Commented Dec 4, 2017 at 14:15

3 Answers 3

1

You can automate installation of base packages on your node. Sharing here apt module definition of the same.

- name: "Installing Rsync"
  apt: >
    pkg={{ item }}
    state=latest
    update_cache=yes
    cache_valid_time=3600
  with_items:
  - rsync

Yum module definition would look something like below.

- name: install the latest version of rsync
  yum:
    name: rsync
    state: latest
6

I may be a little late. But adding an answer here incase it helps some one else.

When the test fails because of 'rsync not found', I believe it's talking about rsync on the ansible controller, not the ansible target.

So if you duplicate this task but make it a local action, then rsync will exist on both ends:

- name: install rsync on the ansible controller
  connection: local
  package:
    name: rsync
    state: present
1
  • 1
    rsync was missing on the ansible controller so this suggested solution worked for me! I got the necessity to set also the become: true option, for the task, to avoid permission issues I faced. Commented Feb 24, 2021 at 0:57
3

You may need to install rsync.

On Centos:

yum install -y rsync

On Ubuntu:

apt install -y rsync
2
  • @skothab...thanks for the replay......I have tried that..Even then iam getting same error.
    – arun mohan
    Commented Dec 5, 2017 at 7:54
  • 3
    @arunmohan did you find a solution to this problem ? I have the same problem here: rsync is clearly installed (which rsync and whereis rsync locate it in /usr/bin and apt install rsync tells me everything is already up-to-date. and still getting error Failed to find required executable rsync in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    – VaN
    Commented May 6, 2019 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .