Ansible 2.10 compatibility issues
pallxk opened this issue · 2 comments
pallxk commented
Lots of things not working any more on Ansible 2.10. For example:
- command
- script
- service
$ ansible --version
ansible 2.10.2
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/x/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.5 (default, Jul 27 2020, 08:42:51) [GCC 10.1.0]
Example Playbooks and errors:
- hosts: openwrt
roles:
- gekmihesg.openwrt
PLAY [openwrt] ***********
TASK [Gathering Facts] ***
[WARNING]: sftp transfer mechanism failed on [openwrt.lan]. Use ANSIBLE_DEBUG=1 to see detailed information
fatal: [openwrt.lan]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "failed": true, "module_stderr": "Shared connection to openwrt.lan closed.\r\n", "module_stdout": "/bin/sh: /usr/bin/python: not found\r\n", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127, "warnings": ["No python interpreters found for host openwrt.lan (tried ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])"]}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}
PLAY RECAP ***************
openwrt.lan : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
- hosts: openwrt
gather_facts: no
roles:
- gekmihesg.openwrt
PLAY [openwrt] *****************************************************
TASK [gekmihesg.openwrt : pin defaults] ****************************
ok: [openwrt.lan]
TASK [gekmihesg.openwrt : install recommended packages] ************
included: /home/lxk/.ansible/roles/gekmihesg.openwrt/tasks/packages.yml for openwrt.lan
TASK [gekmihesg.openwrt : check whether opkg caches need update] ***
ok: [openwrt.lan]
TASK [gekmihesg.openwrt : get current system time] *****************
[WARNING]: No python interpreters found for host openwrt.lan (tried ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])
fatal: [openwrt.lan]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "/bin/sh: /usr/bin/python: not found\n", "module_stdout": "", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127}
PLAY RECAP *********************************************************
openwrt.lan : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
- hosts: openwrt
gather_facts: no
roles:
- name: gekmihesg.openwrt
openwrt_install_recommended_packages: no
tasks:
- shell: echo a
PLAY [openwrt] ********************************************
TASK [gekmihesg.openwrt : pin defaults] *******************
ok: [openwrt.lan]
TASK [gekmihesg.openwrt : install recommended packages] ***
skipping: [openwrt.lan]
TASK [shell] **********************************************
[WARNING]: No python interpreters found for host openwrt.lan (tried ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])
fatal: [openwrt.lan]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "/bin/sh: /usr/bin/python: not found\n", "module_stdout": "", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127}
PLAY RECAP ************************************************
openwrt.lan : ok=1 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
gekmihesg commented
That was easier than expected, but it might be worth looking at the new collection mechanism. Probably the monkey patching isn't needed any more.
NN708 commented
I have the same issue on Ansible 2.10.5:
PLAY [playbook] *************************************************************************************
TASK [Gathering Facts] *************************************************************************
[WARNING]: sftp transfer mechanism failed on [openwrt.lan]. Use ANSIBLE_DEBUG=1 to see detailed information
fatal: [openwrt.lan]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "failed": true, "module_stderr": "Shared connection to openwrt.lan closed.\r\n", "module_stdout": "/bin/sh: /usr/bin/python: not found\r\n", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127, "warnings": ["No python interpreters found for host openwrt.lan (tried ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7', 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])"]}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}
PLAY RECAP *************************************************************************************
openwrt.lan : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
But I’m already using the latest master branch 6e681f9. Could anyone help me?
I finally find out that it is caused by not using openwrt as the group name.