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

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">unarchive</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.4.0 (devel 5741712a09) last updated 2017/05/18 16:08:41 (GMT +200)
  config file = 
  configured module search path = [u'/home/pvdputte/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pvdputte/VC/vendor/ansible-master/lib/ansible
  executable location = /home/pvdputte/VC/vendor/ansible-master/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.4.0 (devel 5741712a09) last updated 2017/05/18 16:08:41 (GMT +200)
  config file = 
  configured module search path = [u'/home/pvdputte/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pvdputte/VC/vendor/ansible-master/lib/ansible
  executable location = /home/pvdputte/VC/vendor/ansible-master/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]

</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Ubuntu 14.04 'Trusty', managing Debian 7.0 'Wheezy'</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">unarchive in current master won't work with remote files anymore. Simply copying lib/ansible/plugins/action/unarchive.py and lib/ansible/modules/files/unarchive.py from ansible 2.3 makes it work again.</p>
<p dir="auto">Perhaps also check out <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="170039309" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/17009" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/17009/hovercard" href="https://github.com/ansible/ansible/issues/17009">#17009</a></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: &quot;install AWStats&quot;
  unarchive:
    remote_src: &quot;yes&quot;
    src:        &quot;http://netix.dl.sourceforge.net/project/awstats/AWStats/7.5/awstats-7.5.tar.gz&quot;
    dest:       &quot;/tmp&quot;
    owner:      &quot;root&quot;
    group:      &quot;root&quot;
    keep_newer: &quot;yes&quot;
    creates:    &quot;/tmp/awstats-7.5&quot;"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">"</span>install AWStats<span class="pl-pds">"</span></span>
  <span class="pl-ent">unarchive</span>:
    <span class="pl-ent">remote_src</span>: <span class="pl-s"><span class="pl-pds">"</span>yes<span class="pl-pds">"</span></span>
    <span class="pl-ent">src</span>:        <span class="pl-s"><span class="pl-pds">"</span>http://netix.dl.sourceforge.net/project/awstats/AWStats/7.5/awstats-7.5.tar.gz<span class="pl-pds">"</span></span>
    <span class="pl-ent">dest</span>:       <span class="pl-s"><span class="pl-pds">"</span>/tmp<span class="pl-pds">"</span></span>
    <span class="pl-ent">owner</span>:      <span class="pl-s"><span class="pl-pds">"</span>root<span class="pl-pds">"</span></span>
    <span class="pl-ent">group</span>:      <span class="pl-s"><span class="pl-pds">"</span>root<span class="pl-pds">"</span></span>
    <span class="pl-ent">keep_newer</span>: <span class="pl-s"><span class="pl-pds">"</span>yes<span class="pl-pds">"</span></span>
    <span class="pl-ent">creates</span>:    <span class="pl-s"><span class="pl-pds">"</span>/tmp/awstats-7.5<span class="pl-pds">"</span></span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">It is expected that the file will be properly downloaded and extracted to the destination directory.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [hclwrk-init : install AWStats] *******************************************
fatal: [com-dhclwrk001.srv.combell-ops.net]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Source 'http://netix.dl.sourceforge.net/project/awstats/AWStats/7.5/awstats-7.5.tar.gz' failed to transfer&quot;}"><pre class="notranslate"><code class="notranslate">TASK [hclwrk-init : install AWStats] *******************************************
fatal: [com-dhclwrk001.srv.combell-ops.net]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Source 'http://netix.dl.sourceforge.net/project/awstats/AWStats/7.5/awstats-7.5.tar.gz' failed to transfer"}
</code></pre></div>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</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">unarchive</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.4.0 (devel 313591f8b8) last updated 2017/04/13 21:20:44 (GMT +200)
  config file = 
  configured module search path = [u'/home/pvdputte/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pvdputte/VC/vendor/ansible-master/lib/ansible
  executable location = /home/pvdputte/VC/vendor/ansible-master/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.4.0 (devel 313591f8b8) last updated 2017/04/13 21:20:44 (GMT +200)
  config file = 
  configured module search path = [u'/home/pvdputte/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pvdputte/VC/vendor/ansible-master/lib/ansible
  executable location = /home/pvdputte/VC/vendor/ansible-master/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Default</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Running from ubuntu 14.04LTS<br>
Managing ubuntu 17.04 (only python 3 after base install)</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Attempting to run the unarchive task to download and extract an http URL yields an error "Source '<a href="http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz" rel="nofollow">http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz</a>' failed to transfer"</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="$ ansible-d targethost -e 'ansible_python_interpreter=/usr/bin/python3' -m unarchive -a &quot;src=http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz dest=/tmp remote_src=true&quot;"><pre class="notranslate"><span class="pl-s">$ ansible-d targethost -e 'ansible_python_interpreter=/usr/bin/python3' -m unarchive -a "src=http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz dest=/tmp remote_src=true"</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">tar.gz file is fetched and extracted in the expected location. E.g. with python 2:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-d targethost -m unarchive -a &quot;src=http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz dest=/tmp remote_src=true&quot;
targethost | SUCCESS =&gt; {
    &quot;changed&quot;: true, 
    &quot;dest&quot;: &quot;/tmp&quot;, 
    &quot;extract_results&quot;: {
        &quot;cmd&quot;: [
            &quot;/bin/tar&quot;, 
            &quot;--extract&quot;, 
            &quot;-C&quot;, 
            &quot;/tmp&quot;, 
            &quot;-z&quot;, 
            &quot;-f&quot;, 
            &quot;/tmp/ansible_3W9Kei/SoapUI-5.3.0-linux-bin.tar.gz&quot;
        ], 
        &quot;err&quot;: &quot;&quot;, 
        &quot;out&quot;: &quot;&quot;, 
        &quot;rc&quot;: 0
    }, 
    &quot;gid&quot;: 0, 
    &quot;group&quot;: &quot;root&quot;, 
    &quot;handler&quot;: &quot;TgzArchive&quot;, 
    &quot;mode&quot;: &quot;01777&quot;, 
    &quot;owner&quot;: &quot;root&quot;, 
    &quot;size&quot;: 4096, 
    &quot;src&quot;: &quot;/tmp/ansible_3W9Kei/SoapUI-5.3.0-linux-bin.tar.gz&quot;, 
    &quot;state&quot;: &quot;directory&quot;, 
    &quot;uid&quot;: 0
}"><pre class="notranslate"><code class="notranslate">$ ansible-d targethost -m unarchive -a "src=http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz dest=/tmp remote_src=true"
targethost | SUCCESS =&gt; {
    "changed": true, 
    "dest": "/tmp", 
    "extract_results": {
        "cmd": [
            "/bin/tar", 
            "--extract", 
            "-C", 
            "/tmp", 
            "-z", 
            "-f", 
            "/tmp/ansible_3W9Kei/SoapUI-5.3.0-linux-bin.tar.gz"
        ], 
        "err": "", 
        "out": "", 
        "rc": 0
    }, 
    "gid": 0, 
    "group": "root", 
    "handler": "TgzArchive", 
    "mode": "01777", 
    "owner": "root", 
    "size": 4096, 
    "src": "/tmp/ansible_3W9Kei/SoapUI-5.3.0-linux-bin.tar.gz", 
    "state": "directory", 
    "uid": 0
}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">ansible 2.3:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="targethost | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;attributes&quot;: null, 
            &quot;backup&quot;: null, 
            &quot;content&quot;: null, 
            &quot;copy&quot;: true, 
            &quot;creates&quot;: null, 
            &quot;delimiter&quot;: null, 
            &quot;dest&quot;: &quot;/tmp&quot;, 
            &quot;directory_mode&quot;: null, 
            &quot;exclude&quot;: [], 
            &quot;extra_opts&quot;: [], 
            &quot;follow&quot;: false, 
            &quot;force&quot;: null, 
            &quot;group&quot;: null, 
            &quot;keep_newer&quot;: false, 
            &quot;list_files&quot;: false, 
            &quot;mode&quot;: null, 
            &quot;original_basename&quot;: &quot;SoapUI-5.3.0-linux-bin.tar.gz&quot;, 
            &quot;owner&quot;: null, 
            &quot;regexp&quot;: null, 
            &quot;remote_src&quot;: true, 
            &quot;selevel&quot;: null, 
            &quot;serole&quot;: null, 
            &quot;setype&quot;: null, 
            &quot;seuser&quot;: null, 
            &quot;src&quot;: &quot;http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz&quot;, 
            &quot;unsafe_writes&quot;: null, 
            &quot;validate_certs&quot;: true
        }
    }, 
    &quot;msg&quot;: &quot;Failure downloading http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz, write() argument must be str, not bytes&quot;
}"><pre class="notranslate"><code class="notranslate">targethost | FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "copy": true, 
            "creates": null, 
            "delimiter": null, 
            "dest": "/tmp", 
            "directory_mode": null, 
            "exclude": [], 
            "extra_opts": [], 
            "follow": false, 
            "force": null, 
            "group": null, 
            "keep_newer": false, 
            "list_files": false, 
            "mode": null, 
            "original_basename": "SoapUI-5.3.0-linux-bin.tar.gz", 
            "owner": null, 
            "regexp": null, 
            "remote_src": true, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz", 
            "unsafe_writes": null, 
            "validate_certs": true
        }
    }, 
    "msg": "Failure downloading http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz, write() argument must be str, not bytes"
}
</code></pre></div>
<p dir="auto">ansible 2.4:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="targethost | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;attributes&quot;: null, 
            &quot;backup&quot;: null, 
            &quot;content&quot;: null, 
            &quot;copy&quot;: true, 
            &quot;creates&quot;: null, 
            &quot;delimiter&quot;: null, 
            &quot;dest&quot;: &quot;/usr/local&quot;, 
            &quot;directory_mode&quot;: null, 
            &quot;exclude&quot;: [], 
            &quot;extra_opts&quot;: [], 
            &quot;follow&quot;: false, 
            &quot;force&quot;: null, 
            &quot;group&quot;: null, 
            &quot;keep_newer&quot;: false, 
            &quot;list_files&quot;: false, 
            &quot;mode&quot;: null, 
            &quot;original_basename&quot;: &quot;SoapUI-5.3.0-linux-bin.tar.gz&quot;, 
            &quot;owner&quot;: null, 
            &quot;regexp&quot;: null, 
            &quot;remote_src&quot;: false, 
            &quot;selevel&quot;: null, 
            &quot;serole&quot;: null, 
            &quot;setype&quot;: null, 
            &quot;seuser&quot;: null, 
            &quot;src&quot;: &quot;http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz&quot;, 
            &quot;unsafe_writes&quot;: null, 
            &quot;validate_certs&quot;: true
        }
    }, 
    &quot;msg&quot;: &quot;Source 'http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz' failed to transfer&quot;
}"><pre class="notranslate"><code class="notranslate">targethost | FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "copy": true, 
            "creates": null, 
            "delimiter": null, 
            "dest": "/usr/local", 
            "directory_mode": null, 
            "exclude": [], 
            "extra_opts": [], 
            "follow": false, 
            "force": null, 
            "group": null, 
            "keep_newer": false, 
            "list_files": false, 
            "mode": null, 
            "original_basename": "SoapUI-5.3.0-linux-bin.tar.gz", 
            "owner": null, 
            "regexp": null, 
            "remote_src": false, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz", 
            "unsafe_writes": null, 
            "validate_certs": true
        }
    }, 
    "msg": "Source 'http://cdn01.downloads.smartbear.com/soapui/5.3.0/SoapUI-5.3.0-linux-bin.tar.gz' failed to transfer"
}
</code></pre></div>
<p dir="auto">Using ansible + python 2 to download on the target system works fine.</p>
<p dir="auto">At first I thought it would be similar to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="197835438" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/19710" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/19710/hovercard" href="https://github.com/ansible/ansible/issues/19710">#19710</a>, but apparently something related has already changed in master, as the 2.4 output looks different.</p>