<p dir="auto">Simply put, if you attempt to use the synchronize module to a local SSH port, such as when you are trying to use synchronize over Vagrant, the rsync command does not appear to work correctly.  Of course, rsyncing with Vagrant is unnecessary since one can simply mount a shared folder, but if you are using Vagrant to test a deployment script, you probably would prefer things to work the same way.</p>
<p dir="auto">Here is the sample of my playbook file:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  - name: Rsync site to the destination machine
    synchronize: &gt;
      src=../sitedir
      dest=/srv/www/{{ name }}/
      archive=no
      recursive=yes"><pre class="notranslate"><code class="notranslate">  - name: Rsync site to the destination machine
    synchronize: &gt;
      src=../sitedir
      dest=/srv/www/{{ name }}/
      archive=no
      recursive=yes
</code></pre></div>
<p dir="auto">Here is an example of what happens when I attempt to synchronize:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK: [Rsync site to the destination machine] ****************************
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-1386703159.57-189216039108571 &amp;&amp; chmod a+rx $HOME/.ansible/tmp/ansible-1386703159.57-189216039108571 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1386703159.57-189216039108571']
&lt;127.0.0.1&gt; PUT /var/folders/FW/FWtcHQi9E5enrfES54KWe++++TI/-Tmp-/tmpZFZVGO TO /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/synchronize
&lt;127.0.0.1&gt; PUT /var/folders/FW/FWtcHQi9E5enrfES54KWe++++TI/-Tmp-/tmpCqD8hJ TO /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/arguments
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', '/usr/bin/python /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/synchronize /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/arguments; rm -rf /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/ &gt;/dev/null 2&gt;&amp;1']
failed: [default] =&gt; {&quot;cmd&quot;: &quot;rsync --delay-updates --compress --timeout=10 --recursive --rsh 'ssh  -o StrictHostKeyChecking=no -o Port=2222' --out-format='&lt;&lt;CHANGED&gt;&gt;%i %n%L' ../sitedir /srv/www/site_dev/&quot;, &quot;failed&quot;: true, &quot;rc&quot;: 12}
msg: rsync: mkdir &quot;/srv/www/site_dev&quot; failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-40/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-40/rsync/io.c(452) [sender=2.6.9]"><pre class="notranslate"><code class="notranslate">TASK: [Rsync site to the destination machine] ****************************
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-1386703159.57-189216039108571 &amp;&amp; chmod a+rx $HOME/.ansible/tmp/ansible-1386703159.57-189216039108571 &amp;&amp; echo $HOME/.ansible/tmp/ansible-1386703159.57-189216039108571']
&lt;127.0.0.1&gt; PUT /var/folders/FW/FWtcHQi9E5enrfES54KWe++++TI/-Tmp-/tmpZFZVGO TO /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/synchronize
&lt;127.0.0.1&gt; PUT /var/folders/FW/FWtcHQi9E5enrfES54KWe++++TI/-Tmp-/tmpCqD8hJ TO /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/arguments
&lt;127.0.0.1&gt; EXEC ['/bin/sh', '-c', '/usr/bin/python /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/synchronize /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/arguments; rm -rf /Users/alex/.ansible/tmp/ansible-1386703159.57-189216039108571/ &gt;/dev/null 2&gt;&amp;1']
failed: [default] =&gt; {"cmd": "rsync --delay-updates --compress --timeout=10 --recursive --rsh 'ssh  -o StrictHostKeyChecking=no -o Port=2222' --out-format='&lt;&lt;CHANGED&gt;&gt;%i %n%L' ../sitedir /srv/www/site_dev/", "failed": true, "rc": 12}
msg: rsync: mkdir "/srv/www/site_dev" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-40/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-40/rsync/io.c(452) [sender=2.6.9]
</code></pre></div>
<p dir="auto">You can tell from the output that the module is attempting to sync between two local filesystem areas instead of from the local filesystem across the SSH tunnel to the proper destination.</p>
<p dir="auto">I have attempted this with both plain ansible 1.4.1 and using the HEAD version (as of now) of the synchronize module.</p>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>


<p dir="auto">modules: ovirt_networks, ovirt_cluster</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/djasa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Nov  3 2017, 10:55:25) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/djasa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Nov  3 2017, 10:55:25) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Cluster network roles would be better set up by ovirt_cluster module to avoid duplication and errors</p>
<h5 dir="auto">LONG DESCRIPTION</h5>
<p dir="auto">when typing my existing RHV setup to ansible, I was wondering why are cluster network roles specified at each network instead of at cluster. The main disadvantages are IMO:</p>
<ul dir="auto">
<li>much more typing. E.g. you have to specify <code class="notranslate">display: false</code> for each network instead of having single <code class="notranslate">display: NETWORK_NAME</code> statement given at cluster</li>
<li>vulnerability to errors for no gain: with per-cluster <code class="notranslate">display: NETWORK_NAME</code>, you can validate that just one network is specified as display right in the ansible module (the same is true for migration network)</li>
</ul>
<p dir="auto">I don't have a strong opinion for VM networks and required networks specification where the inherent validation and less typing are not really applicable (it doesn't matter that much if you specify per-network boolean or per-cluster list in this case).</p>
<p dir="auto">The only downside I can think of is need to have cluster set up split to two tasks but that's IMO an acceptable cost, see example below:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: set up clusters
  ovirt_cluster:
    # everything but networks

- name: set up networks
  ovirt_networks:
    # now set up networks

- name: set up cluster network roles
  ovirt_cluster:
    name: cluster_name
    display_network: my_display_network
    migration_network: my_mgmt_network
    # These are of no real benefit IMO so just for consistency sake...
    required_networks:
    - my_mgmt_network
    - my_display_network
    - infra_servers
    - prod_servers
    vm_networks:
    - infra_servers
    - web_servers
    - playground"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">set up clusters</span>
  <span class="pl-ent">ovirt_cluster</span>:
    <span class="pl-c"><span class="pl-c">#</span> everything but networks</span>

- <span class="pl-ent">name</span>: <span class="pl-s">set up networks</span>
  <span class="pl-ent">ovirt_networks</span>:
    <span class="pl-c"><span class="pl-c">#</span> now set up networks</span>

- <span class="pl-ent">name</span>: <span class="pl-s">set up cluster network roles</span>
  <span class="pl-ent">ovirt_cluster</span>:
    <span class="pl-ent">name</span>: <span class="pl-s">cluster_name</span>
    <span class="pl-ent">display_network</span>: <span class="pl-s">my_display_network</span>
    <span class="pl-ent">migration_network</span>: <span class="pl-s">my_mgmt_network</span>
    <span class="pl-c"><span class="pl-c">#</span> These are of no real benefit IMO so just for consistency sake...</span>
    <span class="pl-ent">required_networks</span>:
    - <span class="pl-s">my_mgmt_network</span>
    - <span class="pl-s">my_display_network</span>
    - <span class="pl-s">infra_servers</span>
    - <span class="pl-s">prod_servers</span>
    <span class="pl-ent">vm_networks</span>:
    - <span class="pl-s">infra_servers</span>
    - <span class="pl-s">web_servers</span>
    - <span class="pl-s">playground</span></pre></div>
<p dir="auto">(originally misfiled as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="281438376" data-permission-text="Title is private" data-url="https://github.com/oVirt/ovirt-ansible/issues/142" data-hovercard-type="issue" data-hovercard-url="/oVirt/ovirt-ansible/issues/142/hovercard" href="https://github.com/oVirt/ovirt-ansible/issues/142">oVirt/ovirt-ansible#142</a>)</p>