title: ansible apt-key module with loop
body: <p>I'm provisioning a system that requires multiple GPG keys to be added. I'm attempting to streamline the process and follow DRY principals.</p>
  <p>I have apt packages installing from a vars list like so:</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: Install packages
    apt: name={{ apt_packages }}
  </code></pre>
  <p>Where my <code>vars.yml</code> looks like this:</p>
  <pre class="lang-yaml prettyprint-override"><code>apt_packages:
    - tilix
    - terraform
    - ansible
    - opera
  </code></pre>
  <p>This works because the <code>apt</code> module accepts comma separated inputs and parses accordingly.</p>
  <p>So I'm trying to achieve a similar process when using the <code>apt_key</code> module but I can't seem to get it to work. Here are a couple of attempts I've made:</p>
  <pre class="lang-yaml prettyprint-override"><code>- name Add keys
    apt_key:
      url: url=&quot;{{ items }}&quot;
      loop: &quot;{{ gpg_keys }}&quot;
      state: present
  </code></pre>
  <p>and</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: Add GPG Keys
    apt_key:
      url: url=&quot;{{ gpg_keys }}&quot;
      state: present
  </code></pre>
  <p>Both throw different errors.</p>
  <p>Is it possible to do something like this using the apt-key module? Obviously I'm trying to avoid having a separate caller for each key I want to add as there will be many keys and I'd like to be able to add additional keys later on by simply appending the list in <code>vars.yml</code>.</p>