Poprzednia rewizja po obu stronachPoprzednia wersja | |
wiki:ansible [2024/12/28 12:45] – 127.0.0.1 | wiki:ansible [2025/04/26 08:45] (aktualna) – 127.0.0.1 |
---|
| |
exclude=ansible-core | exclude=ansible-core |
| |
| === Ansible 2.18 i Python === |
| |
| Nowe wersje Ansibla wymagają Pythona 3.8 na klientach. W RHEL8 domyślnym jest Python 3.6, więc trzeba doinstalować nowszego. Błąd można wywołać nawet pingiem |
| |
| ansible -m ping all -o |
| |
| |
| i wygląda on tak: |
| |
| <code> |
| An exception occurred during task execution. To see the full traceback, use -vvv. The error was: SyntaxError: future feature annotations |
| is not defined |
| host.local | FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": false,"module_stder |
| r": "Shared connection to host.local closed.\r\n","module_stdout": "Traceback (most recent call last):\r\n File \"/home/antik |
| /.ansible/tmp/ansible-tmp-1745649074.378917-9407-261269877273608/AnsiballZ_ping.py\", line 107, in <module>\r\n _ansiballz_main()\r\n |
| File \"/home/antik/.ansible/tmp/ansible-tmp-1745649074.378917-9407-261269877273608/AnsiballZ_ping.py\", line 99, in _ansiballz_main\r\ |
| n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/antik/.ansible/tmp/ansible-tmp-1745649074.378917-9407-2612 |
| 69877273608/AnsiballZ_ping.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._boot |
| strap_external>\", line 544, in spec_from_file_location\r\n File \"/tmp/ansible_ping_payload_598r6p8l/ansible_ping_payload.zip/ansible/ |
| module_utils/basic.py\", line 5\r\nSyntaxError: future feature annotations is not defined\r\n","msg": "MODULE FAILURE: No start of json |
| char found\nSee stdout/stderr for the exact error","rc": 1} |
| </code> |
| |
| Na maszynie //host.local// trzeba zainstalować nowszego Pythona: |
| |
| # dnf module enable python39 |
| # dnf install python39 |
| |
| i w inwentarzu Ansibla poprawić każde wystąpienia //host.local// na: |
| |
| host.local ansible_python_interpreter=/usr/bin/python3.9 |
| |
| |