<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">apt module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="12:40 $ ansible --version
ansible 2.3.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]"><pre class="notranslate"><code class="notranslate">12:40 $ ansible --version
ansible 2.3.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto"><code class="notranslate">(Ubuntu) Linux knowhere 4.4.0-93-generic #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux</code></p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Running apt task with --allow_unauthenticated and the task fails saying that allow_unauthenticated needs to be accepted.</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 required packages
  apt:
    name: '{{ item }}'
    state: latest
    allow_unauthenticated: yes
  with_items:
    - 'python-setproctitle'
    - 'logentries'"><pre class="notranslate"><code class="notranslate">- name: Install required packages
  apt:
    name: '{{ item }}'
    state: latest
    allow_unauthenticated: yes
  with_items:
    - 'python-setproctitle'
    - 'logentries'
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">I expect the packages to 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: [php1-test.test2.infra]: FAILED! =&gt; {
    &quot;cache_update_time&quot;: 1505236342, 
    &quot;cache_updated&quot;: false, 
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;allow_unauthenticated&quot;: false, 
            &quot;autoremove&quot;: null, 
            &quot;cache_valid_time&quot;: 0, 
            &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;name&quot;: &quot;logentries-daemon&quot;, 
            &quot;only_upgrade&quot;: false, 
            &quot;package&quot;: [
                &quot;logentries-daemon&quot;
            ], 
            &quot;purge&quot;: false, 
            &quot;state&quot;: &quot;latest&quot;, 
            &quot;update_cache&quot;: null, 
            &quot;upgrade&quot;: null
        }
    }, 
    &quot;msg&quot;: &quot;'/usr/bin/apt-get -y -o \&quot;Dpkg::Options::=--force-confdef\&quot; -o \&quot;Dpkg::Options::=--force-confold\&quot;     install 'logentries-daemon'' failed: E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n&quot;, 
    &quot;rc&quot;: 100, 
    &quot;stderr&quot;: &quot;E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n&quot;, 
    &quot;stderr_lines&quot;: [
        &quot;E: There were unauthenticated packages and -y was used without --allow-unauthenticated&quot;
    ], 
    &quot;stdout&quot;: &quot;Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following NEW packages will be installed:\n  logentries-daemon\n0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 2970 B of archives.\nAfter this operation, 42.0 kB of additional disk space will be used.\nWARNING: The following packages cannot be authenticated!\n  logentries-daemon\n&quot;, 
    &quot;stdout_lines&quot;: [
        &quot;Reading package lists...&quot;, 
        &quot;Building dependency tree...&quot;, 
        &quot;Reading state information...&quot;, 
        &quot;The following NEW packages will be installed:&quot;, 
        &quot;  logentries-daemon&quot;, 
        &quot;0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.&quot;, 
        &quot;Need to get 2970 B of archives.&quot;, 
        &quot;After this operation, 42.0 kB of additional disk space will be used.&quot;, 
        &quot;WARNING: The following packages cannot be authenticated!&quot;, 
        &quot;  logentries-daemon&quot;
    ]
}"><pre class="notranslate"><code class="notranslate">fatal: [php1-test.test2.infra]: FAILED! =&gt; {
    "cache_update_time": 1505236342, 
    "cache_updated": false, 
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false, 
            "autoremove": null, 
            "cache_valid_time": 0, 
            "deb": null, 
            "default_release": null, 
            "dpkg_options": "force-confdef,force-confold", 
            "force": false, 
            "install_recommends": null, 
            "name": "logentries-daemon", 
            "only_upgrade": false, 
            "package": [
                "logentries-daemon"
            ], 
            "purge": false, 
            "state": "latest", 
            "update_cache": null, 
            "upgrade": null
        }
    }, 
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'logentries-daemon'' failed: E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n", 
    "rc": 100, 
    "stderr": "E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n", 
    "stderr_lines": [
        "E: There were unauthenticated packages and -y was used without --allow-unauthenticated"
    ], 
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following NEW packages will be installed:\n  logentries-daemon\n0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 2970 B of archives.\nAfter this operation, 42.0 kB of additional disk space will be used.\nWARNING: The following packages cannot be authenticated!\n  logentries-daemon\n", 
    "stdout_lines": [
        "Reading package lists...", 
        "Building dependency tree...", 
        "Reading state information...", 
        "The following NEW packages will be installed:", 
        "  logentries-daemon", 
        "0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.", 
        "Need to get 2970 B of archives.", 
        "After this operation, 42.0 kB of additional disk space will be used.", 
        "WARNING: The following packages cannot be authenticated!", 
        "  logentries-daemon"
    ]
}
</code></pre></div>
<p dir="auto">Closing as duplicate of 8736</p>