mitogen icon indicating copy to clipboard operation
mitogen copied to clipboard

simplified module names not working

Open philfry opened this issue 3 years ago • 4 comments

Hi all,

while converting all my playbooks, plugins and stuff to ansible 2.10+ I found that simplified module names won't work with mitogen and 3rdparty modules. FQCN work, though. Simplified names of "common" collections like community.general also work, because there's a plugin_routing for those modules hardcoded in ansible itself.

  • ansible version: 2.10.6
  • mitogen version: v0.3.0rc1 and master
  • python version: 3.9.2 (/usr/bin/python is a symlink to /usr/bin/python3)
  • os: Fedora 33

For this bug report I created two repositories, one for the collection and one for the playbook examples.

To reproduce, follow these steps:

# fetch the latest stable ansible 2.10 version
git clone --depth 1 -b v2.10.6 https://github.com/ansible/ansible.git /var/tmp/ansible2106

# setup environment
. /var/tmp/ansible2106/hacking/env-setup

# fetch the examples
git clone --depth 1 --recursive https://github.com/philfry/ansiblemitogentest.git /var/tmp/mitogentest

# install the dummy collection
ansible-galaxy collection install -r /var/tmp/mitogentest/requirements.yml

Then run the example playbooks.

  • play-example01.yml uses the linear stragegy (thus not using mitogen) and simplified module names. This works:
TASK [debug] *************************************************************************************
ok: [localhost] => {
    "msg": "using simplified module name, not using mitogen"
}

TASK [dummy : print hello world] *****************************************************************
[WARNING]: this is a warning
changed: [localhost] => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": true, "msg": "Hello world"}

  • play-example02.yml uses mitogen_linear and FQCN. This works, too:
TASK [debug] *************************************************************************************
ok: [localhost] => {
    "msg": "using fqcn, using mitogen"
}

TASK [dummy_noshort : print hello world] *********************************************************
[WARNING]: this is a warning
changed: [localhost] => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": true, "msg": "Hello world"}
  • play-example03.yml uses mitogen_linear and simplified module names. This breaks:
TASK [debug] *************************************************************************************
ok: [localhost] => {
    "msg": "using simplified module name, using mitogen"
}

TASK [dummy : print hello world] *****************************************************************
fatal: [localhost]: FAILED! => {"msg": "The module hello was not found in configured module paths"}

Attached: ANSIBLE_DEBUG=1 ansible-playbook play-example03.yml -vvvvv play-example03.txt

philfry avatar Mar 12 '21 08:03 philfry

fwiw, also affects ansible 2.9.18 with mitogen 0.2.9.

philfry avatar Mar 15 '21 14:03 philfry

Just ran into this myself with ansible 2.9.18 and mitogen 0.2.10rc1.

opoplawski avatar Mar 31 '21 19:03 opoplawski

Any plans to try to address this soon?

opoplawski avatar Feb 25 '22 19:02 opoplawski

Unfortunately this remains a big issue with using mitogen with ansible collections.

opoplawski avatar May 23 '22 16:05 opoplawski