~ > ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 19 Jun 8 09:21 /usr/bin/python3 -> /usr/bin/python3.11
I’d set up this symlink before because ansible.legacy.setup had thrown this exception:
Traceback (most recent call last):
File "/home/blorf/.ansible/tmp/ansible-tmp-1717851503.717052-24877-160241396993147/AnsiballZ_setup.py", line 107, in <module>
_ansiballz_main()
File "/home/blorf/.ansible/tmp/ansible-tmp-1717851503.717052-24877-160241396993147/AnsiballZ_setup.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/blorf/.ansible/tmp/ansible-tmp-1717851503.717052-24877-160241396993147/AnsiballZ_setup.py", line 44, in invoke_module
from ansible.module_utils import basic
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 894, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
File "<frozen importlib._bootstrap_external>", line 1131, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1112, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 441, in spec_from_loader
File "<frozen importlib._bootstrap_external>", line 544, in spec_from_file_location
File "/tmp/ansible_ansible.legacy.setup_payload_bpeuy_lf/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py", line 5
SyntaxError: future feature annotations is not defined
…and using a more modern interpreter had solved this issue. In fact, I tried out a few different interpreters. In interactive use, 3.6 seems to work:
~ > sudo ln -sf /usr/bin/python3.6 /usr/bin/python3
~ > firewall-cmd
usage: see firewall-cmd man page
No option specified.
~ > sudo ln -sf /usr/bin/python3.6m /usr/bin/python3
~ > firewall-cmd
usage: see firewall-cmd man page
No option specified.
But that’s not very useful to me because my Ansible playbook fails at the first step (Gathering Facts). Even setting up the firewalld task itself to use python3.6 doesn’t work, but that’s beside the point I think, because it’s down to how that Ansible module is written.
Out of interest, I also tried the command with a slightly more recent version:
~ > sudo ln -sf /usr/bin/python3.9 /usr/bin/python3
~ > firewall-cmd
Traceback (most recent call last):
File "/usr/bin/firewall-cmd", line 24, in <module>
from gi.repository import GObject
ModuleNotFoundError: No module named 'gi'