ansible 错误:无法在路径中找到所需的可执行 rsync:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin"}

aru*_*han 1 linux ansible ansible-playbook

- hosts: host1
  remote_user: root
  tasks:
   - synchronize:
           src: /etc/httpd
           dest: /mytestfile
Run Code Online (Sandbox Code Playgroud)

我收到以下错误。有人可以帮忙吗

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
Run Code Online (Sandbox Code Playgroud)

小智 6

我可能来得有点晚了。但在这里添加一个答案,以防它对其他人有帮助。

当测试因“找不到 rsync”而失败时,我相信它正在谈论 ansible 控制器上的 rsync,而不是 ansible 目标。

因此,如果您复制此任务但将其设为本地操作,则 rsync 将存在于两端:

- name: install rsync on the ansible controller
  connection: local
  package:
    name: rsync
    state: present
Run Code Online (Sandbox Code Playgroud)