Ah. Think I've managed to solve this one myself.
First off, it looks as though I was adding the ignore_errors: true
clause at the wrong level ... originally I'd added as:
- name: Install Python versions
ansible.builtin.apt:
name:
- python3.6
- python3.6-venv
- python3.6-dev
- python3.9
- python3.9-dev
- python3.9-venv
state: latest
update_cache: true
ignore_errors: true
which was causing the errors. Instead, addingindenting ignore_errors
as
- name: Install Python versions
ansible.builtin.apt:
name:
- python3.6
- python3.6-venv
- python3.6-dev
- python3.9
- python3.9-dev
- python3.9-venv
state: latest
update_cache: true
ignore_errors: true
actually works. Alternatively, I could wrap the task(s) in a block and handle the exit conditions with a rescue:
and always:
block.
However, for this particular play, and given that the error is sort of known up-front, I think ignoring it is acceptable here.