# Molecule : basic documentation

**URL:** <https://forum.ansible.com/t/molecule-basic-documentation/37118>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 18, 2022, 8:24am UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118 "2022-09-18T08:24:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sudheer\_S](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@Sudheer\_S](https://forum.ansible.com/u/Sudheer_S)\
**Post date:** [September 18, 2022, 8:24am UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/1 "2022-09-18T08:24:36Z")

</div>

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/)

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

“[pip](https://pip.pypa.io/en/latest/getting-started/) is the only supported installation method.” - is this still true?

“It is highly recommended that you install molecule in a [virtual environment](https://virtualenv.pypa.io/en/latest/user_guide.html).” - 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.

---

<div class="post-metadata">

**Author:** ![m.nelson](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@m.nelson](https://forum.ansible.com/u/m.nelson)\
**Post date:** [September 18, 2022, 12:19pm UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/2 "2022-09-18T12:19:56Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Sudheer\_S](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@Sudheer\_S](https://forum.ansible.com/u/Sudheer_S)\
**Post date:** [September 19, 2022, 4:55am UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/3 "2022-09-19T04:55:13Z")

</div>

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

tasks.main:

---

<div class="post-metadata">

**Author:** ![m.nelson](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@m.nelson](https://forum.ansible.com/u/m.nelson)\
**Post date:** [September 19, 2022, 10:27am UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/4 "2022-09-19T10:27:09Z")

</div>

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

> **(attachments)**
>
> ![cityscoot.gif](https://us1.discourse-cdn.com/ansible/original/2X/c/c6231c19f061c3cbf9e4803886a1aa273a2ab6c1.gif)

---

<div class="post-metadata">

**Author:** ![Sudheer\_S](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@Sudheer\_S](https://forum.ansible.com/u/Sudheer_S)\
**Post date:** [September 19, 2022, 3:05pm UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/5 "2022-09-19T15:05:50Z")

</div>

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](https://us1.discourse-cdn.com/ansible/original/2X/c/c6231c19f061c3cbf9e4803886a1aa273a2ab6c1.gif)

---

<div class="post-metadata">

**Author:** ![Sudheer\_S](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@Sudheer\_S](https://forum.ansible.com/u/Sudheer_S)\
**Post date:** [September 19, 2022, 5:42pm UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/6 "2022-09-19T17:42:10Z")

</div>

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](https://us1.discourse-cdn.com/ansible/original/2X/c/c6231c19f061c3cbf9e4803886a1aa273a2ab6c1.gif)

---

<div class="post-metadata">

**Author:** ![Sudheer\_S](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@Sudheer\_S](https://forum.ansible.com/u/Sudheer_S)\
**Post date:** [September 19, 2022, 5:56pm UTC](https://forum.ansible.com/t/molecule-basic-documentation/37118/7 "2022-09-19T17:56:44Z")

</div>

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

Thank you.

> **(attachments)**
>
> ![cityscoot.gif](https://us1.discourse-cdn.com/ansible/original/2X/c/c6231c19f061c3cbf9e4803886a1aa273a2ab6c1.gif)
