title: Ansible and with_items fails for openjdk-8-jdk followed by jenkins
body: <p>I am trying to install java + jenkins using ansible (2.5.1) on Ubuntu 18.04. I have this role:</p>
  
  <pre><code>- name: Add Jenkins apt repository key.
    apt_key:
      url: "https://pkg.jenkins.io/debian/jenkins.io.key"
      state: present
  
  - name: Add Jenkins apt repository.
    apt_repository:
      repo: "deb http://pkg.jenkins.io/debian-stable binary/"
      state: present
      update_cache: yes
  
  - name: Install Jenkins
    apt: name={{item}} state=latest
    with_items:
         - openjdk-8-jdk
         - jenkins
  </code></pre>
  
  <p>It fails with :</p>
  
  <pre><code>failed: [xxx.xx.xxx.xxx] (item=[u'openjdk-8-jdk', u'jenkins']) =&gt; {"cache_update_time": 1537989126, "cache_updated": false, "changed": false, "item": ["openjdk-8-jdk", "jenkins"], "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'openjdk-8-jdk' 'jenkins'' failed: E: Sub-process /usr/bin/dpkg returned an error code (1)\n", "rc": 100, "stderr": "E: Sub-process /usr/bin/dpkg returned an error code (1)\n", "stderr_lines": ["E: Sub-process /usr/bin/dpkg returned an error code (1)"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following package was automatically installed and is no longer required:\n  linux-modules-4.15.0-29-generic\nUse 'apt autoremove' to remove it.\nThe following additional packages will be installed:\n  adwaita-icon-theme ca-certificates-java daemon dconf-gsettings-backend\n  dconf-service fontconfig fontconfig-conf
  
      ....
  
  /jvm/java-8-openjdk-amd64/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode", "Setting up openjdk-8-jdk:amd64 (8u181-b13-0ubuntu0.18.04.1) ...", "update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode", "update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode", "Processing triggers for libc-bin (2.27-3ubuntu1) ...", "Processing triggers for ureadahead (0.100.0-20) ...", "Processing triggers for systemd (237-3ubuntu10.3) ...", "Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.36.11-2) ...", "Errors were encountered while processing:", " jenkins"]}
  </code></pre>
  
  <p>If I instead split the install into two it works:</p>
  
  <pre><code>- name: Install Java
    apt: name={{item}} state=latest
    with_items:
         - openjdk-8-jdk
  
  - name: Install Jenkins
    apt: name={{item}} state=latest
    with_items:
         - jenkins
  </code></pre>
  
  <p>Any ideas? Can there be some race condition if using <code>with_items</code>?</p>