Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize: Remote source path is prefixed with current working directory #165

Open
rafal-1990 opened this issue Apr 2, 2021 · 1 comment · Fixed by #118
Open

Synchronize: Remote source path is prefixed with current working directory #165

rafal-1990 opened this issue Apr 2, 2021 · 1 comment · Fixed by #118
Labels
bug This issue/PR relates to a bug. has_pr needs_info verified This issue has been verified/reproduced by maintainer waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@rafal-1990
Copy link

SUMMARY

I try to synchronize (pull) a directory to localhost. I don't have console access to the remote host but /usr/bin/rsync -av -e ssh [email protected]:/path/to/sync/ /home/user/backup works.
On the remote host no rsync-deamon is running/allowed. So /usr/bin/rsync -av -e ssh rsync:https://[email protected]:/path/to/sync/ /home/user/backup results in:

insecure rsync options not allowed.
rsync: did not see server greeting
rsync error: error starting client-server protocol (code 5) at main.c(1675) [Receiver=3.1.3]

I also get above error if I specify the src path in the synchronize task like: rsync:https://[email protected]:/path/to/sync/

So I specified the src of synchronize task like: [email protected]:/path/to/sync/.
But this path seems to be treated as a local relative path.

If this behavior is really expected, please treat this report as feature request and please advice how to solve this sync task in another way.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

synchronize

ANSIBLE VERSION
ansible 2.9.6
  config file = /home/user/ansible/test/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
CONFIGURATION
ANSIBLE_PIPELINING(/home/user/ansible/test/ansible.cfg) = True
DEFAULT_ASK_VAULT_PASS(/home/user/ansible/test/ansible.cfg) = True
DEFAULT_HOST_LIST(/home/user/ansible/test/ansible.cfg) = ['/home/user/ansible/test/inventories/hosts']
OS / ENVIRONMENT

Linux Mint 20.1

STEPS TO REPRODUCE
   -  synchronize:
        mode: pull
        src: "[email protected]:/path/to/sync/"
        dest: "/home/user/backup"
        set_remote_user: no
EXPECTED RESULTS

I expect rsync over ssh

ACTUAL RESULTS

src was interpreted as relative local path (and current working directory was prefixed)

fatal: [localhost]: FAILED! => changed=false 
  cmd: /usr/bin/rsync --delay-updates -F --compress --delete-after --archive --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null --out-format=<<CHANGED>>%i %n%L /home/user/ansible/test/[email protected]:/path/to/sync/ /home/user/backup
  msg: |-
    rsync: change_dir "/home/user/ansible/test/[email protected]:/path/to/sync" failed: No such file or directory (2)
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
  rc: 23
@Akasurde Akasurde added bug This issue/PR relates to a bug. needs_verified Needs to reproduced before processing waiting_on_contributor Needs help. Feel free to engage to get things unblocked labels Jun 4, 2021
@saito-hideki
Copy link
Collaborator

saito-hideki commented Jul 22, 2021

Hi @rafal-1990, I think this problem has been addressed in #118. Therefore, if it is possible, can you test with the latest version ansible.posix 1.2.0 ?

I have confirmed the similar issues and it is fixed in the latest version 1.2.0:

TASK [ansible.posix.synchronize] *******************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "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 /home/hsaito/work/testing/collections/playbook/synchronize/redhat@server10:/tmp/test /home/hsaito/work/testing/collections/backup/", "msg": "rsync: change_dir \"/home/hsaito/work/testing/collections/playbook/synchronize/foo@server10:/tmp\" 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", "rc": 23}

@Akasurde Akasurde added needs_info verified This issue has been verified/reproduced by maintainer and removed needs_verified Needs to reproduced before processing labels Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug. has_pr needs_info verified This issue has been verified/reproduced by maintainer waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
3 participants