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

Ansible 2.0 Breaks synchronize functionality, and completely changed the behavior. #11649

Closed
xuchen81 opened this issue Jul 19, 2015 · 6 comments · Fixed by #11783
Closed

Ansible 2.0 Breaks synchronize functionality, and completely changed the behavior. #11649

xuchen81 opened this issue Jul 19, 2015 · 6 comments · Fixed by #11783
Labels
bug This issue/PR relates to a bug. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed
Milestone

Comments

@xuchen81
Copy link

Issue type:
Bug report

Ansible version:
devel

Environment:

Unrelated but
Host: Mac 10.10.3
Target: Ubuntu 10.4

The first issue is:
In 1.9, when I want to sync two folders on the remote server, I do:

- name: Sync app folder
  synchronize:
    src: "/home/ubuntu/test1"
    dest:  "/home/ubuntu/test2"
  delegate_to: "{{ inventory_hostname }}"
  sudo: yes

Now, it keeps giving me permission denied error.

The second issue is:
It looks like now it defaults to sync two folder on the remote server even if I don't specify delegate_to, in 1.9.2, without delegate_to, src will be my local, and dest will be my remote.

Thanks

@bcoca bcoca added bug_report P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed labels Jul 19, 2015
@bcoca bcoca added this to the v2 milestone Jul 19, 2015
@abadger
Copy link
Contributor

abadger commented Jul 23, 2015

Confirmed the second issue. Here's a small playbook that shows the problems:

---
# Localhost is a fedora box
- hosts: rhel6-test
  vars:
    device_host: rhel6-test
    top_dir: /var/tmp
  tasks:
    - name: Push fedora file to rhel host
      synchronize:
        src: "/etc/redhat-release"
        dest: "/var/tmp/fedora-rel"
        mode: push
    - name: Pull redhat file to fedora host
      synchronize:
        src: "/etc/redhat-release"
        dest: "/var/tmp/redhat-rel"
        mode: pull

In current devel, both of those plays are copying the remote /etc/redhat-release file to a file on the remote machine. So the remote machine ends up with /var/tmp/fedora-rel and /var/tmp/redhat-rel and both of those are the /etc/redhat-release from the rhel6 box, not the one from the fedora box that ansible-playbook is being run from.

@xuchen81
Copy link
Author

Yes, the first issue and the second are actually related, since it tries to sync two folders on remote, and I do not have any ssh info on the remote, when src tries to go to ubuntu@ip:dest, it fails, and gives me permission denied error.

I also tried to setup my ssh info on the remote server, and then it succeeded. Therefore, that is the issue.

@abadger
Copy link
Contributor

abadger commented Jul 23, 2015

Small update on my debugging of this -- in 1.9.x the tasks run the ansible module (not just the action plugin) on the controller rather than the remote host. In 2.0 it's running the ansible module on the remote host. Will need to see what is happening with delegate_to to determine if there's a reason that the ansible module exists and try to find the specialcase code in 1.9 that handles this.

@abadger
Copy link
Contributor

abadger commented Jul 23, 2015

This works if delegate_to: localhost is explicitly stated. jimi-c's theory is that in v2 we've already built the connection by the time the synchronize action plugin's run() method is called. So all of the fancy stuff it tries to do to modify how the connection is setup isn't having an effect. Will try to have the synchronize action plugin create its own connection object and use that instead.

@abadger
Copy link
Contributor

abadger commented Jul 23, 2015

delegating to $other host instead of localhost is also working. That would seem to validate jimi-c's theory.

@abadger
Copy link
Contributor

abadger commented Jul 29, 2015

Alright everyone, that PR makes syynchronize work at least for these basic cases for me. Feel free to let us know if you notice additional regressions.

Closing This Ticket

Hi!

We believe recent commits (likely detailed above) should resolve this question or problem for you.

This will also be included in the next major release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular
issue is resolved.

Thank you!

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants