question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make molecule work with ansible-base

See original GitHub issue

Issue Type

  • Feature request

Molecule and Ansible details

molecule 3.0.4
   ansible==2.10.0b1 python==3.7

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Desired Behavior

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—which 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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

13reactions
yajocommented, Feb 5, 2021

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"
3reactions
tadeborocommented, Jan 21, 2021

@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:

  1. molecule + ansible 2.9 -> just works, nothing to do
  2. molecule + ansible < 3.0.0 -> just works, nothing to do
  3. molecule + ansible >= 3.0.0 -> just works, nothing to do
  4. molecule + ansible-base 2.10 -> install community.general < 2.0.0 collection

Once community.general 2.0.0 is out, there will be one more valid combination:

  1. molecule + ansible-base 2.10 -> install community.general >= 2.0.0 and community.docker collections

Once molecule drops support for Ansible 2.8, we can start using FQCNs. The situation will then change into this:

  1. molecule + ansible 2.9 -> install community.docker
  2. molecule + ansible < 3.0.0 -> install community.docker
  3. molecule + ansible >= 3.0.0 -> just works
  4. molecule + ansible-base 2.10 -> install community.docker

I hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developing and Testing Ansible Roles with Molecule and ...
Molecule is a complete testing framework that helps you develop and test Ansible roles, which allows you to focus on the content instead...
Read more >
Getting Started Guide — Molecule Documentation
The following guide will step through an example of developing and testing a new Ansible role. After reading this guide, you should be...
Read more >
Molecule for Ansible role creation - - Rackspace
Molecule provides a way to speed up the development and confidence of Ansible roles and playbooks by wrapping a virtualization driver with tools ......
Read more >
Testing your Ansible roles with Molecule - Jeff Geerling
Dockerfile. · INSTALL. · molecule. · playbook. · tests/ : This directory contains a basic Testinfra test, which you can expand on if...
Read more >
How To Test & Build Quickly Ansible Roles ... - Getbetterdevops
tests contains basic TestInfra unit tests to run additional verification of the result after Ansible got the job done. Configure Molecule. In the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found