Molecule : basic documentation

Hello,

I am trying to make a hello world type testing with Molecule. But it seems that the Molecule documentation is outdated.

https://molecule.readthedocs.io/en/latest/

https://molecule.readthedocs.io/en/latest/installation.html has instructions from Ubuntu 16.x. But not 20.x or 22.x.

pip is the only supported installation method.” - is this still true?

“It is highly recommended that you install molecule in a virtual environment.” - is this still true?

Then the documentation goes on to talk about installing like this:

python3 -m pip install --user “molecule”

I followed the documentation further, created a new role:
molecule init role acme.my_new_role --driver-name docker

cd my_new_role/
cd molecule/default/

molecule test
CRITICAL ‘molecule/default/molecule.yml’ glob failed. Exiting.

give this error.

What steps did I miss or do wrongly?

I am willing to send a pull request to fix the documentation. But I need to know what are the recommended ways of installing molecule and working instructions to setup a new role and test with Molecule.

Hi,

In my experience, the molecule commands need to be executed at the root of the role, therefore you should omit the second cd command:

cd my_new_role/

molecule test

should work

Regards,

I made some progress by adding a task in tasks.yml. It was empty before. Also edited molecule.yml.

tasks.main:

Not sure why you need the other settings, but this works:

(attachments)

cityscoot.gif

If that works for you, then something is probably wrong with my environment.

I have used the same file that you mention. I still get the same error as before.

Somehow, molecule and Ansible do not seem to correctly set privileges on the container.

Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "echo ~/.ansible/tmp"&& mkdir "echo ~/.ansible/tmp/ansible-tmp-1663599793.08011-676381-54041244190778" && echo ansible-tmp-1663599793.08011-676381-54041244190778="echo ~/.ansible/tmp/ansible-tmp-1663599793.08011-676381-54041244190778\

exited with result 1", “unreachable”: true

(attachments)

cityscoot.gif

Could you post your other files please?

I could use that to compare file or maybe run your files without changes and see what could be the issue.

Thanks.

(attachments)

cityscoot.gif

I got it to work. The culprit was the command. I removed the line and it works now.

Thank you.

(attachments)

cityscoot.gif