How do command scp -rp in Ansible ?

37 views
Skip to first unread message

Ryad karkar

unread,
May 22, 2019, 7:54:28 AM5/22/19
to Ansible Project
Hey,

I want can execut this command : scp -rp /somerepertory/myrepertory1/........     /some_repertory/myrepertory1/

How can i do it please ?

I know the module copy :

- name: "task for copy"
  copy:
     src: /somerepertory/myrepertory1/
     dest: /somerepertory/myrepertory1/


But this module do scp -rp or not ?

Thanks for your answer community ansible !! ;)

Regards,

James Cassell

unread,
May 22, 2019, 8:05:37 AM5/22/19
to Ansible List


On Wed, May 22, 2019, at 7:54 AM, Ryad karkar wrote:
> Hey,
>
> I want can execut this command : scp -rp
> /somerepertory/myrepertory1/........ /some_repertory/myrepertory1/
>
> How can i do it please ?
>
> I know the module copy :
>
> - name: "task for copy"
> copy:
> src: /somerepertory/myrepertory1/
> dest: /somerepertory/myrepertory1/
>

Use synchronize. There's no support for recursive copy in the copy module.

V/r,
James Cassell

Ryad karkar

unread,
May 22, 2019, 8:25:20 AM5/22/19
to Ansible Project
OK,

thanks for you answer James Cassell !!

Regards,

Ryad karkar

unread,
May 22, 2019, 8:43:48 AM5/22/19
to Ansible Project
Ok,

When i try to use this module i have on error:

- name: "my synchronize module"
  synhcronize:
     src: /home/michel/*.txt
     dest: //home/carla/
  delegate_to: localhost

Error : not found a repertory but i have some file with extend ".txt"

Someone can you help me please ?!!  :)

Regards,




Le mercredi 22 mai 2019 14:05:37 UTC+2, James Cassell a écrit :

vinoth kumar

unread,
May 31, 2019, 1:03:16 AM5/31/19
to ansible...@googlegroups.com
On Wed, 22 May 2019 at 6:14 PM, Ryad karkar <ryad9...@gmail.com> wrote:
Ok,

When i try to use this module i have on error:

- name: "my synchronize module"
  synhcronize:
     src: /home/michel/*.txt
     dest: //home/carla/
 Here you have to use /home/Carla also this will sync on your local machine.

delegate_to: localhost

Error : not found a repertory but i have some file with extend ".txt"

Someone can you help me please ?!!  :)

Regards,




Le mercredi 22 mai 2019 14:05:37 UTC+2, James Cassell a écrit :


On Wed, May 22, 2019, at 7:54 AM, Ryad karkar wrote:
> Hey,
>
> I want can execut this command : scp -rp
> /somerepertory/myrepertory1/........     /some_repertory/myrepertory1/
>
> How can i do it please ?
>
> I know the module copy :
>
> - name: "task for copy"
>   copy:
>      src: /somerepertory/myrepertory1/
>      dest: /somerepertory/myrepertory1/
>

Use synchronize. There's no support for recursive copy in the copy module.

V/r,
James Cassell

>
> But this module do scp -rp or not ?
>
> Thanks for your answer community ansible !! ;)
>
> Regards,
>

--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fa55ee02-1e01-4d19-8ce5-23d7feb9b557%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stefan Hornburg (Racke)

unread,
May 31, 2019, 1:55:27 AM5/31/19
to ansible...@googlegroups.com
On 5/31/19 7:02 AM, vinoth kumar wrote:
>
>
> On Wed, 22 May 2019 at 6:14 PM, Ryad karkar <ryad9...@gmail.com <mailto:ryad9...@gmail.com>> wrote:
>
> Ok,
>
> When i try to use this module i have on error:
>
> - name: "my synchronize module"
>   synhcronize:
>      src: /home/michel/*.txt
>      dest: //home/carla/
>  Here you have to use /home/Carla also this will sync on your local machine.
>
>
> delegate_to: localhost
>
> Error : not found a repertory but i have some file with extend ".txt"
>
> Someone can you help me please ?!!  :)
>
> Regards,

According to the docs the following task should copy from the inventory host to the Ansible controller
(not tested):

- name: Synchronization of src on the inventory host to the dest on the localhost in pull mode
synchronize:
mode: pull
src: some/relative/path
dest: /some/absolute/path

Regards
Racke

>
>
>
>
> Le mercredi 22 mai 2019 14:05:37 UTC+2, James Cassell a écrit :
>
>
>
> On Wed, May 22, 2019, at 7:54 AM, Ryad karkar wrote:
> > Hey,
> >
> > I want can execut this command : scp -rp
> > /somerepertory/myrepertory1/........     /some_repertory/myrepertory1/
> >
> > How can i do it please ?
> >
> > I know the module copy :
> >
> > - name: "task for copy"
> >   copy:
> >      src: /somerepertory/myrepertory1/
> >      dest: /somerepertory/myrepertory1/
> >
>
> Use synchronize. There's no support for recursive copy in the copy module.
>
> V/r,
> James Cassell
>
> >
> > But this module do scp -rp or not ?
> >
> > Thanks for your answer community ansible !! ;)
> >
> > Regards,
> >
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com <mailto:ansible...@googlegroups.com>.
> <https://groups.google.com/d/msgid/ansible-project/fa55ee02-1e01-4d19-8ce5-23d7feb9b557%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAJ%2BRxtTe_3tHGuXdtBhMhTJj%3D00Bj4BBOM46_%2BYHh7Wh-PBY-A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAJ%2BRxtTe_3tHGuXdtBhMhTJj%3D00Bj4BBOM46_%2BYHh7Wh-PBY-A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc
Reply all
Reply to author
Forward
0 new messages