<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/basictheprogram/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/basictheprogram">@basictheprogram</a> on 2016-10-20T21:26:19Z</p>

<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">script module</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.3.0 (devel 05aed6e52e) last updated 2016/10/18 22:32:33 (GMT -500)
  lib/ansible/modules/core: (detached HEAD b59b5d36e0) last updated 2016/10/18 22:32:33 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD 3f77bb6857) last updated 2016/10/18 22:32:33 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.3.0 (devel 05aed6e52e) last updated 2016/10/18 22:32:33 (GMT -500)
  lib/ansible/modules/core: (detached HEAD b59b5d36e0) last updated 2016/10/18 22:32:33 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD 3f77bb6857) last updated 2016/10/18 22:32:33 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Standard configuration for git pull of the devel branch</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Management host 10.12<br>
Managed host Windows 10</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Attempting to use a script to install chocolatey and getting and error about unable to uncompress the file.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: install chocolatey
  script: 'InstallChocolatey.ps1'
  register: choco
  failed_when: choco.rc != 0
  changed_when: False
  tags: chocolatey"><pre class="notranslate"><code class="notranslate">- name: install chocolatey
  script: 'InstallChocolatey.ps1'
  register: choco
  failed_when: choco.rc != 0
  changed_when: False
  tags: chocolatey
</code></pre></div>
<p dir="auto">The InstallChocolatey.ps1 script</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if ($PSVersionTable.psversion.Major -ge 3)
{
    Write-Verbose &quot;Powershell 3+&quot;
    iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
}
else 
{
    Write-Verbose &quot;Powershell 3 or lower&quot;
    iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}"><pre class="notranslate"><code class="notranslate">if ($PSVersionTable.psversion.Major -ge 3)
{
    Write-Verbose "Powershell 3+"
    iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
}
else 
{
    Write-Verbose "Powershell 3 or lower"
    iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">The latest version of Chocolatey would be installed.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fatal: [PC147.local]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;failed&quot;: true,
    &quot;failed_when_result&quot;: true,
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;_raw_params&quot;: &quot;InstallChocolatey.ps1&quot;
        },
        &quot;module_name&quot;: &quot;script&quot;
    },
    &quot;rc&quot;: 1,
    &quot;stderr&quot;: &quot;Exception calling \&quot;DownloadFile\&quot; with \&quot;2\&quot; argument(s): \&quot;The remote server returned an error: (503) Server Unavailable.\&quot;\r\nAt line:149 char:3\r\n+   $downloader.DownloadFile($url, $file)\r\n+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n+ FullyQualifiedErrorId : WebException\r\n\r\nUnable to unzip package using built-in compression. Set $env:chocolateyUseWindowsCompression = 'false' and call \r\ninstall again to use 7zip to unzip. Error: \r\nYou cannot call a method on a null-valued expression.\r\nAt line:185 char:5\r\n+     throw \&quot;Unable to unzip package using built-in compression. Set `$ ...\r\n+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo          : OperationStopped: (Unable to unzip...ued expression.:String) [], RuntimeException\r\n+ FullyQualifiedErrorId : Unable to unzip package using built-in compression. Set $env:chocolateyUseWindowsCompres \r\nsion = 'false' and call install again to use 7zip to unzip. Error: \r\nYou cannot call a method on a null-valued expression.\r\n&quot;,
    &quot;stdout&quot;: &quot;Getting latest version of the Chocolatey package for download.\r\nDownloading https://chocolatey.org/api/v2/package/chocolatey/0.10.3 to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip\r\nExtracting C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall...\r\n&quot;,
    &quot;stdout_lines&quot;: [
        &quot;Getting latest version of the Chocolatey package for download.&quot;,
        &quot;Downloading https://chocolatey.org/api/v2/package/chocolatey/0.10.3 to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip&quot;,
        &quot;Extracting C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall...&quot;
    ]
}"><pre class="notranslate"><code class="notranslate">fatal: [PC147.local]: FAILED! =&gt; {
    "changed": false,
    "failed": true,
    "failed_when_result": true,
    "invocation": {
        "module_args": {
            "_raw_params": "InstallChocolatey.ps1"
        },
        "module_name": "script"
    },
    "rc": 1,
    "stderr": "Exception calling \"DownloadFile\" with \"2\" argument(s): \"The remote server returned an error: (503) Server Unavailable.\"\r\nAt line:149 char:3\r\n+   $downloader.DownloadFile($url, $file)\r\n+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n+ FullyQualifiedErrorId : WebException\r\n\r\nUnable to unzip package using built-in compression. Set $env:chocolateyUseWindowsCompression = 'false' and call \r\ninstall again to use 7zip to unzip. Error: \r\nYou cannot call a method on a null-valued expression.\r\nAt line:185 char:5\r\n+     throw \"Unable to unzip package using built-in compression. Set `$ ...\r\n+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo          : OperationStopped: (Unable to unzip...ued expression.:String) [], RuntimeException\r\n+ FullyQualifiedErrorId : Unable to unzip package using built-in compression. Set $env:chocolateyUseWindowsCompres \r\nsion = 'false' and call install again to use 7zip to unzip. Error: \r\nYou cannot call a method on a null-valued expression.\r\n",
    "stdout": "Getting latest version of the Chocolatey package for download.\r\nDownloading https://chocolatey.org/api/v2/package/chocolatey/0.10.3 to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip\r\nExtracting C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall...\r\n",
    "stdout_lines": [
        "Getting latest version of the Chocolatey package for download.",
        "Downloading https://chocolatey.org/api/v2/package/chocolatey/0.10.3 to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip",
        "Extracting C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall..."
    ]
}
</code></pre></div>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="184344896" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/5340" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/5340/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/5340">ansible/ansible-modules-core#5340</a></p>
<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 1.5.5</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Running from NixOs, managing GCE (small instance) Debian 7.4 without backports.</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">The problem is that the file and unarchive (possibly others) freeze when using sudo user option on a task. This basically breaks the deploy process.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">The bug can be reproduced with this playbook:<br>
<a href="https://gist.github.com/brodul/11395154">https://gist.github.com/brodul/11395154</a></p>
<p dir="auto">One liner also freezes (after the user is created):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible -i tmp_inventory all -m file -a 'path=/srv/pikapika/engine/current/ state=directory' --sudo-user=pikapika --sudo"><pre class="notranslate"><code class="notranslate">ansible -i tmp_inventory all -m file -a 'path=/srv/pikapika/engine/current/ state=directory' --sudo-user=pikapika --sudo
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">There should be a failure, not a freeze. Or even better a directory called <code class="notranslate">/srv/pikapika/engine/current/</code> owned by 'pikapika'</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">The whole thing freezes</p>
<p dir="auto"><a href="https://gist.github.com/brodul/11395399">https://gist.github.com/brodul/11395399</a></p>
<p dir="auto">Notice there are some anomalies in the gist above:<br>
I changed the project user from 'nomnom' to 'pikapika'. But the 'nomnom' still persist.</p>
<p dir="auto">Tnx for reading this. If you need additional info don't hasitate to ask.<br>
Here is a llama: <a href="https://flic.kr/p/9ybQmk" rel="nofollow">https://flic.kr/p/9ybQmk</a></p>