gekmihesg/ansible-openwrt

ansible 2.10.6 - No python interpreters found

reini-1 opened this issue · 4 comments

Hi!

I wanted to move from ansible 2.9.6 (Ubuntu 20.4) to a more current 20.10.6 ansible version using pyenv and ansible installed with pip but I failed with your module:

TASK [Gathering Facts] ***************************************************************************************************************************************************************
task path: /home/ansible/openwrt-facts.yml:11
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"
}

The playbook for testing is really simple:

- name: OpenWrt setup devices
  hosts: openwrt
  roles:
    - gekmihesg.openwrt
  # gather_facts: true

  tasks:
    - debug: var=ansible_facts

When I set gather_facts to false it works but then I have no facts ...

I think the way ansible >= 2.10 runs vars plugin is the cause, see https://docs.ansible.com/ansible/latest/plugins/vars.html, but I did not figure out, what to set in ansible.cfg to whitelist the vars plugin.

I tried different variants of the following:

vars_plugins_enabled = host_group_vars,gekmihesg.openwrt.monkeypatch
run_vars_plugins = start

With the debian package of ansible version 2.9.6+dfsg-1 it works without a problem.

What else do I have to do to get this awesome module running with ansible 2.10.x?

Thanks in advance.

Are you sure you had the latest version checked out when testing this? Since 6e681f9, compatibility with Ansible >= 2.10 should be fine. Check #25 as well.

I used the version from ansible galaxy but I think it is outdated there.

Last Imported/commit: 2 years ago

So I will try the github version.

Totally forget about that. Just imported the current version there.

jottr commented

Totally forget about that. Just imported the current version there.

May I suggest the use of the appropriate github action to guard against situations like this?