I need to install a number of packages on linux boxes. Some (few) of the packages may be missing for various reasons (OS version, essentially)
- vars:
pkgs:
- there_1
- not_there_1
- there_2
...
but I would like too manage them from a single playbook. So I cannot stick them all in a single
yum: state=latest name="{{pkgs}}"
Because missing packages would mess the transaction so that nothing gets installed.
However, the obvious (and slow) one by one install also fails, because the first missing package blows the entire loop out of the water, thusly:
- name Packages after not_there_1 are not installed
yum: state=latest name="{{item}}"
ignore_errors: yes
with_items: "{{ pkgs }}"
Is there a way to ignore errors within a loop in such a way that all items be given a chance? (i.e. install errors behave as a continue
in the loop)