Ansible 2.0: Synchronize module is hanging

Hey gang,

I’ve been having some issues with the synchronize module in v2. Here’s the code that calls it:

`

  • name: Install to Publish Directory
    synchronize:
    src: “{{ tmp_dir }}/”
    dest: “{{ publish_directory }}/{{ instance_name }}”
    delete: yes
    recursive: yes
    mode: push
    delegate_to: “{{ inventory_hostname }}”
    `

This gets called and just hangs with this output:

`
TASK [restcs_deploy : Install to Publish Directory] *******************
task path: /opt/ansible/release/roles/restcs_deploy/tasks/install.yml:2
[WARNING]: no remote address found for delegated host rundeck.datacenter.company.com, using its name by default

<rundeck.datacenter.company.com> ESTABLISH CONNECTION FOR USER: user on PORT 22 TO rundeck.atxd.maxpointinteractive.com
<rundeck.datacenter.company.com> EXEC (umask 22 && mkdir -p “$(echo $HOME/.ansible/tmp/ansible-tmp-1445025738.21-448766273520)” && echo “$(echo $HOME/.ansible/tmp/ansible-tmp-1445025738.21-448766273520)”)
<rundeck.datacenter.company.com> PUT /tmp/tmpG49x7R TO /home/user/.ansible/tmp/ansible-tmp-1445025738.21-448766273520/synchronize
<rundeck.datacenter.company.com> EXEC /bin/sh -c ‘sudo -H -p “[sudo via ansible, key=uaprwqkxcglkzwhmgqgrqxrnevnleaum] password: " -S -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-uaprwqkxcglkzwhmgqgrqxrnevnleaum; LANG=C LC_MESSAGES=C LC_CTYPE=C /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1445025738.21-448766273520/synchronize; rm -rf “/home/user/.ansible/tmp/ansible-tmp-1445025738.21-448766273520/” > /dev/null 2>&1’”‘"’’
^CProcess WorkerProcess-5:
Traceback (most recent call last):
File “/usr/lib/python2.7/multiprocessing/process.py”, line 258, in _bootstrap
self.run()
File “/opt/ansible-src/lib/ansible/executor/process/worker.py”, line 100, in run
(host, task, basedir, job_vars, play_context, shared_loader_obj) = self._main_q.get()
`

I included the stacktrace from the Control-C in case that’s helpful, but that hung like that for about an hour. I tried to merge in:

https://github.com/ansible/ansible/pull/12783

But I’m still having the issue. It’s worth noting that the playbook does have “become: yes”, and I’m proxying through a jumphost, but all of this works fine in 1.9

Any Thoughts?

Corwin:
I had this problem also… including sometimes not giving any output at all…
In my case, i had a with_items clause and what seemed to help was to add a when clause above the with_items and verify all the attributes are defined.

The other thing i’ve found with delegate_to is having all the variables defined for that host.

So what you might try to confirm/deny this is:

  • name: Install to Publish Directory
    debug: var=tmp_dir
    delegate_to: “{{ inventory_hostname }}”

  • name: Install to Publish Directory
    debug: var=instance_name
    delegate_to: “{{ inventory_hostname }}”

  • name: Install to Publish Directory
    debug: var=publish_directory
    delegate_to: “{{ inventory_hostname }}”

That’s my $0.02… good luck.