Thanks. I did not know that debug was part of ansible.posix.
I had to install the collection:
ansible-galaxy collection install ansible.posix
Now it works again.
I think it was installed before as part of the ansible package and now I am only using ansible-core which means I need to install all collections manually.