[ansible-project] execute Synchronize module in AAP 2.3

56 views
Skip to first unread message

Prady A

unread,
Dec 13, 2023, 5:56:45 AM12/13/23
to ansible...@googlegroups.com
Hello experts 

I ve simple piece of below code 

    - Name: Install rsync on the Target
      package:
        name: rsync
        state: present
    
    - Name: Synchronize file from local to remote   
      synchronize:
         src: /tmp/memo.txt
         dest: /temp/test
code I can run the code using ansible-playbook command but when I am executing it via ansible automation platform gui it is giving me the below error
Message . No file error. 
cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --out-format='<<CHANGED>>%i %n%L' /tmp/memo.txt root@xyz1234:/tmp/test",  "msg": "Warning: Permanently added 'xyz1234,148.168.65.73' (ECDSA) to the list of known hosts.\r\nWARNING!\n                          This system, owned by the Company, may be used only by authorized personnel for authorized purposes. All activities conducted on and communications and other information, including personal information, accessed, processed, stored, or transmitted using the system may be examined, recorded, copied, used and disclosed in accordance with applicable law. The Company monitors systems to safeguard the security of its systems and data, to protect against policy violations and unlawful activity, to administer working relationships, and to meet legal obligations and promises to business partners. By proceeding, you agree to use the system only for authorized purposes and in accordance with Company policies that have been made available to you. For additional information consult your local business's employee privacy notice or contact your local Privacy Officer.\nrsync: link_stat \"/tmp/memo.txt\" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]\n",

Though I kept /tmp/memo.txt in both control node and execution node still the error persist. Kindly suggest 

Thanks 
pd 





Rowe, Walter P. (Fed)

unread,
Dec 13, 2023, 7:56:26 AM12/13/23
to ansible...@googlegroups.com
AAP uses execution environments which are containers. If /tmp/memo.txt is not known to the container the task will fail.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services Division
Mobile: 202.355.4123

--
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/CAEuB3AqOxr3AbQ9k-vgCdJtgmLTm3ZvKBBD645mNW-F9F_p%2BeQ%40mail.gmail.com.

Dick Visser

unread,
Dec 13, 2023, 8:24:22 AM12/13/23
to ansible...@googlegroups.com
Hii
If it really is just one file, you can use the copy module...

Prady A

unread,
Dec 13, 2023, 8:43:41 AM12/13/23
to ansible...@googlegroups.com
Thank you for your direction and suggestion..
actually we want to sync http folder not a file 
Is there any way I can sync between 2 servers.?

Regards 
Prady

On Wed, 13 Dec 2023 at 22:24, Dick Visser <dnmv...@gmail.com> wrote:
Hii
If it really is just one file, you can use the copy module...

--
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,
Dec 13, 2023, 8:52:29 AM12/13/23
to ansible...@googlegroups.com
On Wed, 13 Dec 2023 at 14:43, Prady A <pradyu...@gmail.com> wrote:
Thank you for your direction and suggestion..
actually we want to sync http folder not a file 
Is there any way I can sync between 2 servers.?

You can, with the synchronize module. But as explained above, your specific setup includes containers, so that needs some work. What exactly depends on your setup, if you can mount volumes, etc. Something that is known to you. IIRC the product you are using (AAP) includes support, so that would be the most logical thing to try.

If you folder is not too big you can still use the copy module:


You should experiment a bit with that.


Prady A

unread,
Dec 13, 2023, 9:20:02 AM12/13/23
to ansible...@googlegroups.com
Hi Dick

Thank you for the directions. If I not wrong all AAP uses containers to execute the templates and this is not specific to me. I m not sure why ansible AAP provided which does not work in the out of box bundle. let me chk with RH support..
Thank a lot again.. 



--
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.

Rowe, Walter P. (Fed)

unread,
Dec 13, 2023, 10:24:45 AM12/13/23
to ansible...@googlegroups.com
If the files to sync are part of the project that includes the playbook then it is present inside the container. If the files / folder to sync reside elsewhere, you need to delegate that task(s) to that source system where they reside that you want to sync.


Walter
--
Walter Rowe, Division Chief
Infrastructure Services Division
Mobile: 202.355.4123

Prady A

unread,
Dec 13, 2023, 8:18:12 PM12/13/23
to ansible...@googlegroups.com
Thanks a Ton Walter and dick
Delegate option filnlally worked.. 
I wonder how copy module works even though the concept are same.

Regards 
PD

Rowe, Walter P. (Fed)

unread,
Dec 14, 2023, 8:47:16 AM12/14/23
to ansible...@googlegroups.com
I wonder how copy module works even though the concept are same.

Again, if the source is part of the project then it will be visible to the playbook. If it is not you need to delegate_to the source host and provide the correct source path for the source host.


Walter
--
Walter Rowe, Division Chief
Infrastructure Services Division
Mobile: 202.355.4123
Reply all
Reply to author
Forward
0 new messages