Iterating over a simple list
Repeated tasks can be written as standard loops over a simple list of strings. You can define the list directly in the task.
You can define the list in a variables file, or in the ‘vars’ section of your play, then refer to the name of the list in the task.
Either of these examples would be the equivalent of
You can pass a list directly to a parameter for some plugins. Most of the packaging modules, likeyumandapt, have this capability. When available, passing the list to a parameter is better than looping over the task. For example
Check themodule documentationto see if you can pass a list to any particular module’s parameter(s).