ansible error: Failed to find required executable rsync in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin"}

12,462

Solution 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

Solution 2

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

Solution 3

You may need to install rsync.

On Centos:

yum install -y rsync

On Ubuntu:

apt install -y rsync
Share:
12,462

Related videos on Youtube

arun mohan
Author by

arun mohan

Updated on September 18, 2022

Comments

  • arun mohan
    arun mohan over 1 year
    - 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
    
    • dortegaoh
      dortegaoh over 6 years
      rsync is not installed ... at least not in the given directories.
  • arun mohan
    arun mohan over 6 years
    @skothab...thanks for the replay......I have tried that..Even then iam getting same error.
  • VaN
    VaN about 5 years
    @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
  • OPMendeavor
    OPMendeavor about 3 years
    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.