- name: DOWNLOAD | CREATE PLUGIN CACHE DIRECTORY
  # =====================================================================
  sudo: No
  delegate_to: 127.0.0.1
  action: file
  args:
    path: "{{download_cache}}/jenkins/jenkins-plugin-{{item.name}}/"
    state: "directory"
  with_items: jenkins_plugins

- name: DOWNLOAD | PLUGINS
  # =====================================================================
  sudo: No
  delegate_to: 127.0.0.1
  action: get_url
  args:
      url: "{{jenkins_plugin_download_url}}/{{item.name}}/{{item.version}}/{{item.name}}.hpi"
      dest: "{{download_cache}}/jenkins/jenkins-plugin-{{item.name}}/{{item.name}}-{{item.version}}.hpi"
  when: item.enabled
  with_items: jenkins_plugins

- name: DOWNLOAD | CREATE PLUGIN CACHE DIRECTORY
  # =====================================================================
  sudo: No
  delegate_to: 127.0.0.1
  action: file
  args:
    path: "{{download_cache}}/jenkins/jenkins-plugin-{{item.name}}/"
    state: "directory"
  with_items: "{{jenkins_plugins}}"

- name: DOWNLOAD | PLUGINS
  # =====================================================================
  sudo: No
  delegate_to: 127.0.0.1
  action: get_url
  args:
      url: "{{jenkins_plugin_download_url}}/{{item.name}}/{{item.version}}/{{item.name}}.hpi"
      dest: "{{download_cache}}/jenkins/jenkins-plugin-{{item.name}}/{{item.name}}-{{item.version}}.hpi"
  when: item.enabled
  with_items: "{{jenkins_plugins}}"

Handle a missing jenkins plugins configuration gracefully
Handle a missing jenkins plugins configuration gracefully

Previously there was a error if jenkins_plugins was defined but empty.
