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

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

<p dir="auto">win_chocolatey</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 01436cf186) last updated 2017/02/21 12:05:34 (GMT -500)
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.3.0 (devel 01436cf186) last updated 2017/02/21 12:05:34 (GMT -500)
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">Ansible configuration from git clone</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Control host macOS 10.12.3<br>
Managed host Windows 7</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Attempting to upgrade powershell4 to powershell5 using the win_chocolatey module.</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: install powershell5
  win_chocolatey:
    name: '{{ item }}'
    state: 'present'
  with_items:
    - &quot;powershell&quot;
  register: check_powershell5
  when: &quot;{{ ansible_PSVersionTable.Major|int &lt; 5 }}&quot;
  tags: chocolatey"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">install powershell5</span>
  <span class="pl-ent">win_chocolatey</span>:
    <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">'</span>{{ item }}<span class="pl-pds">'</span></span>
    <span class="pl-ent">state</span>: <span class="pl-s"><span class="pl-pds">'</span>present<span class="pl-pds">'</span></span>
  <span class="pl-ent">with_items</span>:
    - <span class="pl-s"><span class="pl-pds">"</span>powershell<span class="pl-pds">"</span></span>
  <span class="pl-ent">register</span>: <span class="pl-s">check_powershell5</span>
  <span class="pl-ent">when</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ ansible_PSVersionTable.Major|int &lt; 5 }}<span class="pl-pds">"</span></span>
  <span class="pl-ent">tags</span>: <span class="pl-s">chocolatey</span></pre></div>

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

<p dir="auto">Upgrade/install of powershell5</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Ansible/win_chocolatey error out.</p>

<p dir="auto"><a href="https://gist.github.com/basictheprogram/018789574e04104932c002777e5a3a76">https://gist.github.com/basictheprogram/018789574e04104932c002777e5a3a76</a></p>
<p dir="auto">As an alternative solution to bug <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="42095764" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/8904" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/8904/hovercard" href="https://github.com/ansible/ansible/issues/8904">#8904</a></p>