molecule 3.0.4
ansible==2.10.0b1 python==3.7
Molecule installation method (one of):
Ansible installation method (one of):
I have been doing some testing with both ansible-base and ansible, and noticed that Molecule fails to work at all (at least with the default Docker driver) under ansible-base, since it calls the docker_container module directly鈥攚hich is not part of the base distribution anymore.
It would be nice if Molecule were updated to install the community.general collection and use the community.general.docker_container module if it detects it is not available... somehow.
This is probably a bit of a niche use case, though, but it would be helpful for me so I could test whether a bug affects ansible-base _and_ ansible (2.10 and later), or just ansible-base or ansible (2.10 and later).
Right now I basically can't use molecule if I'm testing with ansible-base locally.
There are serious issues with ansible wheels with 2.10 especially related to upgrading from 2.9.x but they have nothing to do with molecule itself.
We cannot start using FQCN until we drop support for 2.8, which would be after 2.10 is GA.
At this moment we cannot really make molecule depend on ansible-base as we have modules that need full ACD. Still, once we move them out of core and we also move minimal version to 2.10, we could switch to requiring ansible-base. In case it was not obvious this cannot be sooner than one year from now.
Acknowledged; it's going to be a bit of a mess trying to debug playbook-level issues that arise between ansible, ansible-base, and ansible 2.9 and lower in the meanwhile :-/
Ansible 2.10 has been released !
https://groups.google.com/g/ansible-announce/c/QxIOml3i62A
https://pypi.org/project/ansible/2.10.0/#files
Yep, but we will be able to add dependency on ansible-base only when we drop support for 2.9, which will happen when 2.11 is released.
Since 3.1.3 this is already true, molecule no longer needs ansible.
How did you get this to work? Does molecule support ansible 2.10? I figured out that I have to pip install molecule[docker] and ansible-galaxy collection install community.docker to get the docker functionality, but molecule still fails:
ERROR! couldn't resolve module/action 'docker_container'. This often indicates a misspelling, missing collection, or incorrect module path.
because molecule_docker/playbooks/destroy.yml uses docker_container: instead of community.docker.docker_container:? Or is there some way to get the ansible docker modules in a "legacy" format?
We must keep the short names for backwards compatibility but please add a PR to add the "collections:" bit which is ignored on older ansible versions.
@richm Things are a bit complicated at the moment because the docker Ansible content is in transition between the community.general and the community.docker collections. If you want to use molecule, these are your options right now:
Once community.general 2.0.0 is out, there will be one more valid combination:
Once molecule drops support for Ansible 2.8, we can start using FQCNs. The situation will then change into this:
I hope this helps.
Thanks for the details @tadeboro. For me, adding this tests/molecule/default/collections.yml file fixed the problem (using ansible-base 2.10 and molecule 3.2.3:
collections:
- name: community.docker
version: ">=1.2.0,<2"
- name: community.general
version: ">=2,<3"
FYI these aren't an issue with either Ansible 3.0 or 3.1 which include the necessary versions. Only a problem if you have an older version installed in your collections.
$ ansible-galaxy collection list |grep -e docker -e general
community.docker 1.2.2
community.general 2.0.1
$ ansible-galaxy collection list |grep -e docker -e general
community.docker 1.3.0
community.general 2.2.0
Most helpful comment
Thanks for the details @tadeboro. For me, adding this
tests/molecule/default/collections.ymlfile fixed the problem (using ansible-base 2.10 and molecule 3.2.3: