rsync failure

289 views
Skip to first unread message

Ashok Reddy

unread,
Aug 1, 2022, 3:04:05 AM8/1/22
to Ansible Project
---
- hosts: all
  become: true
  become_method: sudo
  gather_facts: true
  tasks:
    - name: rsync
      ansible.posix.synchronize:
        src: /root
        dest: /root
      delegate_to: hostname

error:


TASK [rsync] **********************************************************************************************************************************************************************************************
fatal: [ FAILED! => {"changed": false, "msg": "Failed to find required executable \"rsync\" in paths: /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin"}
fatal: [localhost -> ]: FAILED! => {"changed": false, "msg": "Could not determine controller hostname for rsync to send to"}

PLAY RECAP ***************************************************************************************************************************************************************

dulh...@mailbox.org

unread,
Aug 1, 2022, 3:37:49 AM8/1/22
to ansible...@googlegroups.com
my guess: Ansible detects that the host has no rsync installed, so the TASK can not be executed.
So you'd you have to create a preceeding (package/yum/apt) TASK that makes sure rsync is installed on the hosts in order to make this work.

Ashok Reddy

unread,
Aug 1, 2022, 6:24:02 AM8/1/22
to ansible...@googlegroups.com

---

- hosts: all

  become: true

  become_method: sudo

  gather_facts: true

  tasks:

    - name: block

      block:

        - name: rsync

          command: "cat /proc/meminfo"

      rescue:

        - debug:

            msg: proceed to install

        - name: install rsync

          dnf:

            name: rsync

            state: present

          delegate_to: localhost

    - name: sync

      ansible.posix.synchronize:

        src: /root

        dest: /root

      delegate_to: inventory hostname


Error:


 FAILED! => {"changed": false, "msg": "Could not determine controller hostname for rsync to send to"}



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/931614963.59128.1659339453322%40office.mailbox.org.

Dick Visser

unread,
Aug 1, 2022, 6:48:34 AM8/1/22
to ansible...@googlegroups.com
On Mon, 1 Aug 2022 at 12:23, Ashok Reddy <ashok...@gmail.com> wrote:

---

- hosts: all

  become: true

  become_method: sudo

  gather_facts: true

  tasks:

    - name: block

      block:

        - name: rsync

          command: "cat /proc/meminfo"

      rescue:

        - debug:

            msg: proceed to install

        - name: install rsync

          dnf:

            name: rsync

            state: present

          delegate_to: localhost

    - name: sync

      ansible.posix.synchronize:

        src: /root

        dest: /root

      delegate_to: inventory hostname


Error:


 FAILED! => {"changed": false, "msg": "Could not determine controller hostname for rsync to send to"}



The listeral string "inventory hostname" is not a valid hostname. Fix that.
Also, "become_method: sudo" and "gather_facts: true" are both the same as the defaults, so you can leave that out.

Ashok Reddy

unread,
Aug 1, 2022, 7:07:23 AM8/1/22
to ansible...@googlegroups.com
Hi Team,

whatever i've mentioned the inventory hostname just ref i.e not the actual one.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.

Dick Visser

unread,
Aug 1, 2022, 8:37:59 AM8/1/22
to ansible...@googlegroups.com
Well in that case you will have to find out for yourself why it doesn't work.

John Petro

unread,
Aug 1, 2022, 8:47:49 AM8/1/22
to ansible...@googlegroups.com
Have you run the playbook in verbose mode to get more detail?  Maybe there's a mis-spelling in the inventory hostname you used or something in the inventory.  

The only other idea I have is to copy/paste the msg section that starts with "Could" into your search engine of choice and see what comes up there.  

--John 


Hearn, Stan J.

unread,
Aug 1, 2022, 9:13:23 AM8/1/22
to ansible...@googlegroups.com

Isn't src and dest the same place?

Ashok Reddy

unread,
Aug 1, 2022, 9:59:26 PM8/1/22
to ansible...@googlegroups.com
both are in the different hostnames.

You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/7dszRgDhwxY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/PH0PR10MB5593EC179DC1113880752658F09A9%40PH0PR10MB5593.namprd10.prod.outlook.com.
Reply all
Reply to author
Forward
0 new messages