So pulling in synchronize between two remote servers works like a champ:
---
- hosts: web14
  remote_user: jlouthan
  tasks:
      - name: Get current timestamp
        local_action: command bash -c 'date +%Y-%m-%d.%H%M'
        register: timestamp
        run_once: true

      - name: Get current datestamp
        local_action: command bash -c 'date +%Y-%m-%d'
        register: datestamp
        run_once: true

      - name: Create test file
        file: path=/home/jlouthan/testing{{ timestamp.stdout }} state=touch

      - name: List the file recently created
        shell: ls -la /home/jlouthan | grep {{ datestamp.stdout }}
        register: touchtest

      - debug: var=touchtest.stdout_lines

      - pause: prompt='Note the name of the file'

      - name: Pull test file from web16 to web14
        synchronize: mode=pull src=/home/jlouthan/testing{{ 
timestamp.stdout }} dest=/home/jlouthan/
        delegate_to: web16

      - name: List test files from today
        shell: ls -la /home/jlouthan | grep {{ datestamp.stdout }}
        delegate_to: web16
        register: destcheck

      - debug: var=destcheck.stdout_lines

      - pause: prompt='Check dest test files'



However, pushing from one remote server to another does not work:
$ cat test-push-files.yml
---
- hosts: web16
  remote_user: jlouthan
  tasks:
      - name: Get current timestamp
        local_action: command bash -c 'date +%Y-%m-%d.%H%M'
        register: timestamp

      - name: Get current datestamp
        local_action: command bash -c 'date +%Y-%m-%d'
        register: datestamp

      - name: Create test file
        file: path=/home/jlouthan/testing{{ timestamp.stdout }} state=touch
        delegate_to: web14

      - name: List the file recently created
        shell: ls -la /home/jlouthan | grep {{ datestamp.stdout }}
        delegate_to: web14
        register: touchtest

      - debug: var=touchtest.stdout_lines

      - pause: prompt='Note the name of the file'

      - name: Pull test file from web14 to web16
        synchronize: src=/home/jlouthan/testing{{ timestamp.stdout }} 
dest=/home/jlouthan
        delegate_to: web14

PLAY 
***************************************************************************


TASK [setup] 
*******************************************************************

ok: [web16]


TASK [Get current timestamp] 
***************************************************

changed: [web16 -> localhost]


TASK [Get current datestamp] 
***************************************************

changed: [web16 -> localhost]


TASK [Create test file] 
********************************************************

changed: [web16 -> web14]


TASK [List the file recently created] 
******************************************

changed: [web16 -> web14]


TASK [debug] 
*******************************************************************

ok: [web16] => {

    "touchtest.stdout_lines": [

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 14:43 
testing2016-05-02.0843",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 14:45 
testing2016-05-02.0845",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 14:46 
testing2016-05-02.0846",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 14:56 
testing2016-05-02.0856",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 15:06 
testing2016-05-02.0906",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 15:14 
testing2016-05-02.0914",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 15:18 
testing2016-05-02.0918",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 15:19 
testing2016-05-02.0919",

        "-rw-r--r--  1 jlouthan jlouthan        0 May  2 15:25 
testing2016-05-02.0925"

    ]

}


TASK [pause] 
*******************************************************************

[pause]

Note the name of the file:

ok: [web16]


TASK [Pull test file from web14 to web16] 
**************************************

fatal: [web16 -> web14]: FAILED! => {"changed": false, "cmd": 
"/usr/bin/rsync --delay-updates -F --compress --archive --rsh '/usr/bin/ssh 
 -S none -o StrictHostKeyChecking=no' --out-format='<<CHANGED>>%i %n%L' 
\"/home/jlouthan/testing2016-05-02.0925\" \"web16:/home/jlouthan\"", 
"failed": true, "msg": "rsync: --out-format=<<CHANGED>>%i %n%L: unknown 
option\nrsync error: syntax or usage error (code 1) at main.c(1231) 
[client=2.6.8]\n", "rc": 1}


NO MORE HOSTS LEFT 
*************************************************************

to retry, use: --limit @test-push-files.retry


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

web16                      : ok=7    changed=4    unreachable=0    failed=1



I tried following the examples using rsync within synchronize:
dest=http://web16/home/jlouthan/

... and that doesn't seem to work for me.

I guess what I am asking is how do you rsync pushing from one remote server 
to another (as oppose to pulling which I can successfully do).

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/267281d9-1b36-4c2a-9829-dc3e0abd8755%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to