How do command scp -rp in Ansible ?

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 !! :wink:

Regards,

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

OK,

thanks for you answer James Cassell !!

Regards,

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 ?!! :slight_smile:

Regards,

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

    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 ?!! :slight_smile:

    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