3 ms·
That’s not right either. It’s super wasteful since newer versions of Ansible don’t magic loops into a single call to your package manager anymore. You have to p
by Spivak 6y ago
That’s not right either. It’s super wasteful since newer versions of Ansible don’t magic loops into a single call to your package manager anymore. You have to pass the list as a single item.
- name: Install stuff.
package:
name: [git, httpd]
- crmrc114 6y agoAgreed, great callout for the example use case, my point was simply using the items list which could even be used for something like shell or win_shell
- deeblering4 6y agoIs this the case too with other resources, like users? I noticed that those loops can become pretty time consuming as the user list gets larger.
- geerlingguy 6y agoIt depends on the module; the user module works on one entity at a time, so you have to loop at the task level, which does take a little longer that trying to pass through a batch of user data at once.
- emmelaich 6y agoNote that it was possible to install multiple packages in one call by passing the whole list to yum/apt. This was undocumented but happened to work. You just had to supply the list as space separated. i.e. package: {{ packages|join(' ') }} or similar