---

- 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"}



On Mon, Aug 1, 2022 at 1:07 PM dulhaver via Ansible Project <
ansible-project@googlegroups.com> wrote:

>
> > On 08/01/2022 9:04 AM CEST Ashok Reddy <ashokrd...@gmail.com> wrote:
> >
> >
> > ---
> > - 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
> ***************************************************************************************************************************************************************
>
> 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.
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/931614963.59128.1659339453322%40office.mailbox.org
> .
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKRLcHivNDFmVEMYgo6WLL%3DtHsa1RJK1BGOeLLt6pNZcAO4T9A%40mail.gmail.com.

Reply via email to