I wanted to draw attention to this issue, filed earlier today by
opoplwaski:
- https://github.com/ansible/ansible/issues/12976
It highlights several regressions between 1.9.x and 2.0.0, primarily
concerning situations in which Ansible attempts to "squash" a list of
arguments for performance reasons (e.g., for package managers). The
TL;DR is that this works under 1.9.x...
- name: Install common packages
dnf:
name: "{{item.name}}"
state: "{{item.state}}"
with_items:
- { name: bash-completion, state: present }
- { name: sssd, state: present }
...but fails under 2.0.0. There are additional failures, as well,
related to when template expressions are evaluated (apparently earlier
in 1.9.x and later in 2.0.0).
I'm wondering if it would make sense to (a) just remove the item
squashing code, which seems pretty hacky at first glance, and (b)
rewrite the packaging modules to accept a list of packages in
addition to a single name. So the above would become something like:
- name: Install common packages
dnf:
state: present
name:
- bash-completion
- sssd
This gets you the performance advantage of batched package installs
without the weird special-casing for these modules. I realize that
this is not a perfect equivalent to the first example, because all
pacakges get the same value for 'state', but I think that's a valid
restriction and would ultimately make the underlying code much more
maintainable.