<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report / Feature Idea</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.1.0.0"><pre class="notranslate">$ <span class="pl-s1">ansible --version</span>
<span class="pl-c1">ansible 2.1.0.0</span></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Ubuntu 16.04.1</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Ubuntu 16 comes without <code class="notranslate">aptitude</code> package:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" &quot;Could not find aptitude. Please ensure it is installed.&quot;"><pre class="notranslate"><span class="pl-c1"> "Could not find aptitude. Please ensure it is installed."</span></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Tasks with <code class="notranslate">upgrade</code> parameter fails:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a &quot;upgrade=full&quot;
lab.xxx | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;msg&quot;: &quot;Could not find aptitude. Please ensure it is installed.&quot;
}
~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a &quot;upgrade=yes&quot;
lab.xxx | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;msg&quot;: &quot;Could not find aptitude. Please ensure it is installed.&quot;
}
~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a &quot;upgrade=full&quot;
lab.xxx | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;msg&quot;: &quot;Could not find aptitude. Please ensure it is installed.&quot;
}
~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a &quot;upgrade=safe&quot;
lab.xxx | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;msg&quot;: &quot;Could not find aptitude. Please ensure it is installed.&quot;
}"><pre class="notranslate"><span class="pl-c1">~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a "upgrade=full"</span>
<span class="pl-c1">lab.xxx | FAILED! =&gt; {</span>
<span class="pl-c1">    "changed": false, </span>
<span class="pl-c1">    "failed": true, </span>
<span class="pl-c1">    "msg": "Could not find aptitude. Please ensure it is installed."</span>
<span class="pl-c1">}</span>
<span class="pl-c1">~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a "upgrade=yes"</span>
<span class="pl-c1">lab.xxx | FAILED! =&gt; {</span>
<span class="pl-c1">    "changed": false, </span>
<span class="pl-c1">    "failed": true, </span>
<span class="pl-c1">    "msg": "Could not find aptitude. Please ensure it is installed."</span>
<span class="pl-c1">}</span>
<span class="pl-c1">~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a "upgrade=full"</span>
<span class="pl-c1">lab.xxx | FAILED! =&gt; {</span>
<span class="pl-c1">    "changed": false, </span>
<span class="pl-c1">    "failed": true, </span>
<span class="pl-c1">    "msg": "Could not find aptitude. Please ensure it is installed."</span>
<span class="pl-c1">}</span>
<span class="pl-c1">~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a "upgrade=safe"</span>
<span class="pl-c1">lab.xxx | FAILED! =&gt; {</span>
<span class="pl-c1">    "changed": false, </span>
<span class="pl-c1">    "failed": true, </span>
<span class="pl-c1">    "msg": "Could not find aptitude. Please ensure it is installed."</span>
<span class="pl-c1">}</span></pre></div>
<p dir="auto">Only <code class="notranslate">upgrade=dist</code> work fine:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a &quot;upgrade=dist&quot;
lab.xxx | SUCCESS =&gt; {
    &quot;changed&quot;: false, 
    &quot;msg&quot;: &quot;Reading package lists...\nBuilding dependency tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n&quot;, 
    &quot;stderr&quot;: &quot;&quot;, 
    &quot;stdout&quot;: &quot;Reading package lists...\nBuilding dependency tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n&quot;, 
    &quot;stdout_lines&quot;: [
        &quot;Reading package lists...&quot;, 
        &quot;Building dependency tree...&quot;, 
        &quot;Reading state information...&quot;, 
        &quot;Calculating upgrade...&quot;, 
        &quot;0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.&quot;
    ]
}"><pre class="notranslate"><span class="pl-c1">~/ansible-scripts $ ansible -i inventory/hosts lab -m apt -a "upgrade=dist"</span>
<span class="pl-c1">lab.xxx | SUCCESS =&gt; {</span>
<span class="pl-c1">    "changed": false, </span>
<span class="pl-c1">    "msg": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n", </span>
<span class="pl-c1">    "stderr": "", </span>
<span class="pl-c1">    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n", </span>
<span class="pl-c1">    "stdout_lines": [</span>
<span class="pl-c1">        "Reading package lists...", </span>
<span class="pl-c1">        "Building dependency tree...", </span>
<span class="pl-c1">        "Reading state information...", </span>
<span class="pl-c1">        "Calculating upgrade...", </span>
<span class="pl-c1">        "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."</span>
<span class="pl-c1">    ]</span>
<span class="pl-c1">}</span></pre></div>
<p dir="auto"><em>From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/tjbenator/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tjbenator">@tjbenator</a> on April 23, 2016 7:18</em></p>

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

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<ul dir="auto">
<li>apt</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.0.1.0"><pre class="notranslate"><code class="notranslate">ansible 2.0.1.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Mostly defaults, nothing that would affect this.<br>
<a href="https://github.com/binarypenguin/automation/blob/master/ansible.cfg">https://github.com/binarypenguin/automation/blob/master/ansible.cfg</a></p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Ubuntu 16.04 -&gt; Ubuntu 16.04</p>
<h5 dir="auto">SUMMARY</h5>

<h5 dir="auto">STEPS TO REPRODUCE</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible [HOSTNAME] -m apt -a 'update_cache=yes cache_valid_time=3600'"><pre class="notranslate"><code class="notranslate">ansible [HOSTNAME] -m apt -a 'update_cache=yes cache_valid_time=3600'
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Download apt updates</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="HOSTNAME | FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;cache_valid_time&quot;: 3600, 
            &quot;deb&quot;: null, 
            &quot;default_release&quot;: null, 
            &quot;dpkg_options&quot;: &quot;force-confdef,force-confold&quot;, 
            &quot;force&quot;: false, 
            &quot;install_recommends&quot;: null, 
            &quot;package&quot;: null, 
            &quot;purge&quot;: false, 
            &quot;state&quot;: &quot;present&quot;, 
            &quot;update_cache&quot;: true, 
            &quot;upgrade&quot;: null
        }, 
        &quot;module_name&quot;: &quot;apt&quot;
    }, 
    &quot;msg&quot;: &quot;Could not fetch updated apt files&quot;
}"><pre class="notranslate"><code class="notranslate">HOSTNAME | FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "cache_valid_time": 3600, 
            "deb": null, 
            "default_release": null, 
            "dpkg_options": "force-confdef,force-confold", 
            "force": false, 
            "install_recommends": null, 
            "package": null, 
            "purge": false, 
            "state": "present", 
            "update_cache": true, 
            "upgrade": null
        }, 
        "module_name": "apt"
    }, 
    "msg": "Could not fetch updated apt files"
}
</code></pre></div>
<p dir="auto"><code class="notranslate">sudo apt-get update</code> works fine on the host. I thought the issue was that Ubuntu 16.04 LTS does not include Aptitude by default. Also python-apt wasn't installed. Installing them both on the remote machine did not fix the issue.</p>
<p dir="auto"><em>Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="150526382" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/3523" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/3523/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/3523">ansible/ansible-modules-core#3523</a></em></p>