One of the changes with ansible 2.7 is how you are supposed to pass a list of packages to a package module. instead of passing a list via with_items (which then get’s squashed into one call anyway), you just pass the whole list.
Apt as an example:
ansible <= 2.6
1 2 3 4 | - name: Install packages apt: pkg: "{{ item }}" state: present with_items: "{{ packages }" |
ansible <= 2.7
1 2 3 4 | - name: Install packages apt: pkg: "{{ packages }}" state: present |
What the documentation doesn’t touch is how to pass multiple lists.
The error output suggests using ['{{ list1 }}', '{{ list2 }}']
, but ansible throws a fit if you do that. Turns out you can also concatenate lists with the + sign. So the solution looks like this:
1 2 3 4 | - name: Install packages apt: pkg: "{{ packages + more_packages }}" state: present |