After last system update I’ve got a problems with running ansible. Description of a problem (will paste it below) points to problems with Python.
Local versions:
- ansible core 2.17.0
- python version = 3.12.3
- jinja version = 3.1.3
I use Manjaro on my PC and laptop. So I installed updates first on PC and faced problems, while laptop had previous version of ansible (unfortunately I didn’t save version) with same version of python and everything works perfect.
At the end of a day I’ve install updates on laptop too and start to face same problems with ansible/python. Now I have both systems with same problem…
Error log:
{
"ansible.legacy.setup": {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"exception": "Traceback (most recent call last):\r\n File \"/home/osp-admin/.ansible/tmp/ansible-tmp-1717068157.1190922-26108-232864809873690/AnsiballZ_setup.py\", line 107, in <module>\r\n _ansiballz_main()\r\n File \"/home/osp-admin/.ansible/tmp/ansible-tmp-1717068157.1190922-26108-232864809873690/AnsiballZ_setup.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/osp-admin/.ansible/tmp/ansible-tmp-1717068157.1190922-26108-232864809873690/AnsiballZ_setup.py\", line 44, in invoke_module\r\n from ansible.module_utils import basic\r\n File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\r\n File \"<frozen importlib._bootstrap>\", line 951, in _find_and_load_unlocked\r\n File \"<frozen importlib._bootstrap>\", line 894, in _find_spec\r\n File \"<frozen importlib._bootstrap_external>\", line 1157, in find_spec\r\n File \"<frozen importlib._bootstrap_external>\", line 1131, in _get_spec\r\n File \"<frozen importlib._bootstrap_external>\", line 1112, in _legacy_get_spec\r\n File \"<frozen importlib._bootstrap>\", line 441, in spec_from_loader\r\n File \"<frozen importlib._bootstrap_external>\", line 544, in spec_from_file_location\r\n File \"/tmp/ansible_ansible.legacy.setup_payload_03yi8pil/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py\", line 5\r\nSyntaxError: future feature annotations is not defined\r\n",
"failed": true,
"module_stderr": "Shared connection to *(some builder host)* closed.\r\n",
"module_stdout": "Traceback (most recent call last):\r\n File \"/home/osp-admin/.ansible/tmp/ansible-tmp-1717068157.1190922-26108-232864809873690/AnsiballZ_setup.py\", line 107, in <module>\r\n _ansiballz_main()\r\n File \"/home/osp-admin/.ansible/tmp/ansible-tmp-1717068157.1190922-26108-232864809873690/AnsiballZ_setup.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/osp-admin/.ansible/tmp/ansible-tmp-1717068157.1190922-26108-232864809873690/AnsiballZ_setup.py\", line 44, in invoke_module\r\n from ansible.module_utils import basic\r\n File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\r\n File \"<frozen importlib._bootstrap>\", line 951, in _find_and_load_unlocked\r\n File \"<frozen importlib._bootstrap>\", line 894, in _find_spec\r\n File \"<frozen importlib._bootstrap_external>\", line 1157, in find_spec\r\n File \"<frozen importlib._bootstrap_external>\", line 1131, in _get_spec\r\n File \"<frozen importlib._bootstrap_external>\", line 1112, in _legacy_get_spec\r\n File \"<frozen importlib._bootstrap>\", line 441, in spec_from_loader\r\n File \"<frozen importlib._bootstrap_external>\", line 544, in spec_from_file_location\r\n File \"/tmp/ansible_ansible.legacy.setup_payload_03yi8pil/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py\", line 5\r\n**SyntaxError: future feature annotations is not defined**\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"warnings": [
"Platform linux on host environment_host is using the discovered Python interpreter at /usr/bin/python3, but future installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-core/2.17/reference_appendices/interpreter_discovery.html for more information."
]
}
}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"
}
I did research for this error (SyntaxError: future feature annotations is not defined), and everything points to problem with python.
Was trying to configure python’s intepreter in ansible.cfg, but without success.
Remote builder host has these versions:
ansible 2.9.10
python version = 2.7.5
But as I said, before last update, everything work as a charm.