Incongruous implementation of `with_items` in package modules

Consider the following use case for managing modules in an apache role:

Assume apache_install_modules is a list containing the items: module1, module2, and module3

  • name: install modules
    apt: name=libapache2-mod-{{ item }} state=present
    with_items: apache_install_modules
  • name: enable modules
    apache2_module: name={{ item }} state=present
    with_items: apache_install_modules

So far as I have read the Ansible documentation, the above should work; however, special handling for the apt (and other package modules) does a unique compilation step causing the apt task above to be interpreted as:

  • name: install modules
    apt: name=libapache2-mod-module1,module2,module3 state=present

This is contrary to the intent of the user and contrary to the documented behavior of with_items. To me, this seems really bad.

It’s really really really good, because you install everything in a single package transaction, saving lots of time.
This comes up only sporadically.

Now, extra processing could be done to decide that the templating is weird, and to fix that argument yes. That would be nice.

Something you might like to work on, perhaps?