Um24.04 and ansible

Created a VM, um24.04 (host um24) but the ansible playbook fails.

um24.04 comes with python 3.12.3 but um22.04 comes with python 3.10.12

The playbook works fine with um22.04 but not with um24.04

The error was: ModuleNotFoundError: No module named 'ansible.module_utils.six.moves'
um24 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    "changed": false,

Any suggestions?

Seems to be a known problem with ansible vs python3.12
You are not alone, read this:
python3:12 ModuleNotFoundError: No module named 'ansible.module_utils.six.moves' error when running ansible · Issue #875 · docker-library/python · GitHub

It seems that upgrading to a newer versions of ansible would fix this.
See also this:

EDIT: Indeed, Python has broken backwards compatibility again.
You might either upgrade Ansible or downgrade to Python 3.11


I upgraded my ansible core to 2.12.0 Took me 8 days; my playbook works now with python 3.12.

Thanks @tkn