<h5 dir="auto">ISSUE TYPE</h5>

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

<ul dir="auto">
<li>synchronize</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2.3.0.0"><pre class="notranslate"><code class="notranslate">2.3.0.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<ul dir="auto">
<li>ansible.cfg</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=600s
control_path = %(directory)s/%%h-%%r
pipelining = True"><pre class="notranslate"><code class="notranslate">[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=600s
control_path = %(directory)s/%%h-%%r
pipelining = True
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Linux 4.10.10-1-MANJARO"><pre class="notranslate"><code class="notranslate">Linux 4.10.10-1-MANJARO
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Rsync synchronization does not work on 2.3.0.0, works on 2.2.2.0</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: Rsync upload to server
  synchronize: src={{ config_local_path }} dest={{ rails_release_path }} rsync_opts=--exclude-from='{{ config_local_path }}.gitignore' owner=no group=no
  become: yes
  become_user: &quot;{{ user }}&quot;"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Rsync upload to server</span>
  <span class="pl-ent">synchronize</span>: <span class="pl-s">src={{ config_local_path }} dest={{ rails_release_path }} rsync_opts=--exclude-from='{{ config_local_path }}.gitignore' owner=no group=no</span>
  <span class="pl-ent">become</span>: <span class="pl-s">yes</span>
  <span class="pl-ent">become_user</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ user }}<span class="pl-pds">"</span></span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">On version 2.2.2.0 works as expected, executing</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/usr/bin/rsync --delay-updates -F --compress --archive --no-owner --no-group --rsh 'ssh  -S none -o StrictHostKeyChecking=no' --rsync-path=\&quot;sudo rsync\&quot; --exclude-from='/home/kostafun/Projects/domain.com/.gitignore' --out-format='&lt;&lt;CHANGED&gt;&gt;%i %n%L' \&quot;/home/kostafun/Projects/domain.com/\&quot; \&quot;root@2.2.2.2:/home/bk/domain/releases/20170423080009\&quot;"><pre class="notranslate"><code class="notranslate">/usr/bin/rsync --delay-updates -F --compress --archive --no-owner --no-group --rsh 'ssh  -S none -o StrictHostKeyChecking=no' --rsync-path=\"sudo rsync\" --exclude-from='/home/kostafun/Projects/domain.com/.gitignore' --out-format='&lt;&lt;CHANGED&gt;&gt;%i %n%L' \"/home/kostafun/Projects/domain.com/\" \"root@2.2.2.2:/home/bk/domain/releases/20170423080009\"
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">On 2.3.0.0 executing</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" /usr/bin/rsync --delay-updates -F --compress --archive --no-owner --no-group --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no --rsync-path=sudo rsync --exclude-from='/home/kostafun/Projects/domain.com/.gitignore' --out-format=&lt;&lt;CHANGED&gt;&gt;%i %n%L /home/kostafun/Projects/domain.com/ root@2.2.2.2:/home/bk/domain/releases/20170423070910"><pre class="notranslate"><code class="notranslate"> /usr/bin/rsync --delay-updates -F --compress --archive --no-owner --no-group --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no --rsync-path=sudo rsync --exclude-from='/home/kostafun/Projects/domain.com/.gitignore' --out-format=&lt;&lt;CHANGED&gt;&gt;%i %n%L /home/kostafun/Projects/domain.com/ root@2.2.2.2:/home/bk/domain/releases/20170423070910
</code></pre></div>
<p dir="auto">with the following results</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rsync: failed to open exclude file '/home/kostafun/Projects/domain.com/.gitignore': No such file or directory (2)\nrsync error: error in file IO (code 11) at exclude.c(1178) [client=3.1.2]\n"><pre class="notranslate"><code class="notranslate">rsync: failed to open exclude file '/home/kostafun/Projects/domain.com/.gitignore': No such file or directory (2)\nrsync error: error in file IO (code 11) at exclude.c(1178) [client=3.1.2]\n
</code></pre></div>
<p dir="auto">Note no quotes --rsync-path=sudo rsync  --out-format=&lt;&gt;%i %n%L<br>
Commit <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="218342588" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/23157" data-hovercard-type="pull_request" data-hovercard-url="/ansible/ansible/pull/23157/hovercard" href="https://github.com/ansible/ansible/pull/23157">#23157</a> ?</p>

<p dir="auto">Complete -vvv output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/synchronize.py
&lt;2.2.2.2&gt; ESTABLISH LOCAL CONNECTION FOR USER: kostafun
&lt;2.2.2.2&gt; EXEC /bin/sh -c '/usr/bin/python2 &amp;&amp; sleep 0'
fatal: [2.2.2.2]: FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;cmd&quot;: &quot;/usr/bin/rsync --delay-updates -F --compress --archive --no-owner --no-group --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no --rsync-path=sudo rsync --exclude-from='/home/kostafun/Projects/domain.com/.gitignore' --out-format=&lt;&lt;CHANGED&gt;&gt;%i %n%L /home/kostafun/Projects/domain.com/ root@2.2.2.2:/home/bk/domain/releases/20170423070910&quot;, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;_local_rsync_path&quot;: &quot;rsync&quot;, 
            &quot;_substitute_controller&quot;: false, 
            &quot;archive&quot;: true, 
            &quot;checksum&quot;: false, 
            &quot;compress&quot;: true, 
            &quot;copy_links&quot;: false, 
            &quot;delete&quot;: false, 
            &quot;dest&quot;: &quot;root@2.2.2.2:/home/bk/domain/releases/20170423070910&quot;, 
            &quot;dest_port&quot;: null, 
            &quot;dirs&quot;: false, 
            &quot;existing_only&quot;: false, 
            &quot;group&quot;: false, 
            &quot;links&quot;: null, 
            &quot;mode&quot;: &quot;push&quot;, 
            &quot;owner&quot;: false, 
            &quot;partial&quot;: false, 
            &quot;perms&quot;: null, 
            &quot;private_key&quot;: null, 
            &quot;recursive&quot;: null, 
            &quot;rsync_opts&quot;: [
                &quot;--exclude-from='/home/kostafun/Projects/domain.com/.gitignore'&quot;
            ], 
            &quot;rsync_path&quot;: &quot;sudo rsync&quot;, 
            &quot;rsync_timeout&quot;: 0, 
            &quot;set_remote_user&quot;: true, 
            &quot;src&quot;: &quot;/home/kostafun/Projects/domain.com/&quot;, 
            &quot;ssh_args&quot;: null, 
            &quot;times&quot;: null, 
            &quot;verify_host&quot;: false
        }
    }, 
    &quot;msg&quot;: &quot;rsync: failed to open exclude file '/home/kostafun/Projects/domain.com/.gitignore': No such file or directory (2)\nrsync error: error in file IO (code 11) at exclude.c(1178) [client=3.1.2]\n&quot;, 
    &quot;rc&quot;: 11
}
"><pre class="notranslate"><code class="notranslate">Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/synchronize.py
&lt;2.2.2.2&gt; ESTABLISH LOCAL CONNECTION FOR USER: kostafun
&lt;2.2.2.2&gt; EXEC /bin/sh -c '/usr/bin/python2 &amp;&amp; sleep 0'
fatal: [2.2.2.2]: FAILED! =&gt; {
    "changed": false, 
    "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --no-owner --no-group --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no --rsync-path=sudo rsync --exclude-from='/home/kostafun/Projects/domain.com/.gitignore' --out-format=&lt;&lt;CHANGED&gt;&gt;%i %n%L /home/kostafun/Projects/domain.com/ root@2.2.2.2:/home/bk/domain/releases/20170423070910", 
    "failed": true, 
    "invocation": {
        "module_args": {
            "_local_rsync_path": "rsync", 
            "_substitute_controller": false, 
            "archive": true, 
            "checksum": false, 
            "compress": true, 
            "copy_links": false, 
            "delete": false, 
            "dest": "root@2.2.2.2:/home/bk/domain/releases/20170423070910", 
            "dest_port": null, 
            "dirs": false, 
            "existing_only": false, 
            "group": false, 
            "links": null, 
            "mode": "push", 
            "owner": false, 
            "partial": false, 
            "perms": null, 
            "private_key": null, 
            "recursive": null, 
            "rsync_opts": [
                "--exclude-from='/home/kostafun/Projects/domain.com/.gitignore'"
            ], 
            "rsync_path": "sudo rsync", 
            "rsync_timeout": 0, 
            "set_remote_user": true, 
            "src": "/home/kostafun/Projects/domain.com/", 
            "ssh_args": null, 
            "times": null, 
            "verify_host": false
        }
    }, 
    "msg": "rsync: failed to open exclude file '/home/kostafun/Projects/domain.com/.gitignore': No such file or directory (2)\nrsync error: error in file IO (code 11) at exclude.c(1178) [client=3.1.2]\n", 
    "rc": 11
}

</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">synchronize</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.0.0
  config file = /tmp/ansible-test/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Jan 12 2017, 17:59:37) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.0.0
  config file = /tmp/ansible-test/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Jan 12 2017, 17:59:37) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">synchronize doesn't handle <code class="notranslate">rsync_opts</code> correctly.<br>
In my case, the <code class="notranslate">--exclude</code> option was ignored, fscking up my webserver config.</p>
<p dir="auto">ansible 2.2.2.0 works fine, though.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto"><a href="https://gist.github.com/philfry/9b7d4ac4ce2dc511accc3ba8e150ef40">https://gist.github.com/philfry/9b7d4ac4ce2dc511accc3ba8e150ef40</a></p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto"><code class="notranslate">*.conf</code> get synchronized, <code class="notranslate">*.module</code> are left untouched.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/tmp/foo-dest/dontdeleteme2.module
/tmp/foo-dest/dontdeleteme1.module
/tmp/foo-dest/someconfig.conf
/tmp/foo-dest/overwriteme.conf
/tmp/foo-dest/anotherconf.conf

/tmp/foo-src/anotherconf.conf
/tmp/foo-src/overwriteme.conf"><pre class="notranslate"><code class="notranslate">/tmp/foo-dest/dontdeleteme2.module
/tmp/foo-dest/dontdeleteme1.module
/tmp/foo-dest/someconfig.conf
/tmp/foo-dest/overwriteme.conf
/tmp/foo-dest/anotherconf.conf

/tmp/foo-src/anotherconf.conf
/tmp/foo-src/overwriteme.conf
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto"><code class="notranslate">*.conf</code> get synchronized, <code class="notranslate">*.module</code> get deleted.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/tmp/foo-dest/overwriteme.conf
/tmp/foo-dest/anotherconf.conf

/tmp/foo-src/anotherconf.conf
/tmp/foo-src/overwriteme.conf"><pre class="notranslate"><code class="notranslate">/tmp/foo-dest/overwriteme.conf
/tmp/foo-dest/anotherconf.conf

/tmp/foo-src/anotherconf.conf
/tmp/foo-src/overwriteme.conf
</code></pre></div>

<p dir="auto"><a href="https://gist.github.com/philfry/d5e3c38c94f3ad631196aff37aea22de">https://gist.github.com/philfry/d5e3c38c94f3ad631196aff37aea22de</a></p>