Questions tagged [molecule]

Molecule is a Python package designed to aid in the development and testing of Ansible roles.

Molecule is a Python package designed to aid in the development and testing of Ansible roles. It includes support for multiple instances, operating system distributions, virtualization providers, and test frameworks.

It leverages Vagrant, Docker, and OpenStack to manage virtual machines/containers, with support for multiple Vagrant providers (currently VirtualBox, Parallels, VMware Fusion, and Libvirt). Molecule supports Serverspec, Testinfra, or Goss (beta) to run tests. Molecule uses an Ansible playbook (playbook.yml), to execute the role and its tests.

Find the source on Github and the documentation on the official website.

139 questions
2
votes
0 answers

How to get IP/Hostname of All Hosts in a Molecule / TestInfra test?

i have a simple role, which just gets the ip/hostnames of all hosts in the play, and updates the /etc/hosts file. - name: Add the inventory into /etc/hosts lineinfile: dest: /etc/hosts regexp: '.*{{ item }}$' line: "{{…
Justin S
  • 774
  • 2
  • 11
  • 22
2
votes
2 answers

How to customize molecule's docker image?

I'm using Molecule to test some Ansible roles. I would like to push some files to the docker image used for testing. For that purpose, I put my test file in the molecule folder and ADD/COPY commands are added to the Dockerfile.j2 file. My folder…
pgrandjean
  • 676
  • 1
  • 9
  • 19
2
votes
1 answer

How to convert molecule from graph representation to RDKit Mol

I'm working on a Python project involving molecules, and for now I have been representing molecules as graphs. I have three different numpy arrays describing each graph: a binary adjacency matrix, an array storing the atomic number of each atom in…
Daniele Grattarola
  • 1,517
  • 17
  • 25
1
vote
2 answers

How to obtain all n atom fragments (substructures) from a mol file using RDKIT?

I am interested in obtaining fragments, or sub structures, that contain 4 non-hydrogen atoms within a larger molecule. The closest example to accomplishing this is referenced…
1
vote
2 answers

How to "mock" groups in molecule unit test for Ansible?

I have this task definition for a Role I have written a molecule unit test for. --- - name: Debug JDBC lines ansible.builtin.debug: msg: "jdbc_connection_string_np{{ my_idx }}=jdbc:mysql://{{ item }}:3306/np" with_items: "{{…
Red Cricket
  • 9,762
  • 21
  • 81
  • 166
1
vote
1 answer

ansible.legacy.setup fails with return code 0 and no messages in new Molecule role

I'm trying to run molecule converge on a newly-created Molecule role (created by running molecule init role shahradr.srx_config --driver-name docker), but I'm getting the following error when running the converge step: fatal: [instance]: FAILED! =>…
ShahradR
  • 11
  • 4
1
vote
1 answer

molecule test seems to ignore ansible.cfg's remote_tmp setting

I am trying to use molecule to test a very basic role. (venv) [red@jumphost docker-ops]$ cat roles/fake_role/tasks/main.yml --- # tasks file for fake_role - name: fake_role | debug remote_tmp debug: msg: "remote_tmp is {{ remote_tmp |…
Red Cricket
  • 9,762
  • 21
  • 81
  • 166
1
vote
0 answers

Molecule cannot connect to docker

I cannot make molecule test. I got error as below: fatal: [instance]: UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target…
mkozub
  • 23
  • 2
1
vote
0 answers

How can I redirect molecule's output to stdout and stderr into a file?

My molecule invocation looks like this: molecule test -s default 2>&1 test.log Unfortunately, the command doesn't test the scenario: INFO default scenario test matrix: dependency, lint, cleanup, destroy, syntax, create, prepare, converge,…
oschlueter
  • 2,596
  • 1
  • 23
  • 46
1
vote
0 answers

RDKIT export dataframe to .mol or .sdf file

I need to convert a bunch of Smiles into mold2 using this GUI tools (https://www.fda.gov/files/science%20&%20research/published/Mold2-Tutorial.pdf) How do I convert pandas data frame into either .mol or .sdf file?
Petr
  • 1,606
  • 2
  • 14
  • 39
1
vote
2 answers

Is there a way to run molecule tests with external dependencies?

I have several roles that run actions on a remote database that executes sentences for user and privilege creation. I have seen molecule used to test playbooks that run against a single host, but I am unsure of how you could setup a second container…
srb
  • 81
  • 5
1
vote
1 answer

How to override entrypoint for molecule[podman] containers

molecule can create containers or VMs to test ansible roles. I am using containers which run systemd to test the role in multiple environments. To run systemd I am using the command: option but in one container i cannot do that because of the…
xihh
  • 169
  • 2
  • 12
1
vote
0 answers

Ansible Molecule SSL Errors

I am running Ansible molecule test cases. However, I am seeing SSL validation errors! Does someone aware of this error? Any alternatives to fix this problem? More details below: [root@ansible automation]# /root/.local/bin/molecule converge INFO …
1
vote
1 answer

Unable to override role name with meta/main.yml role_name for molecule test

I created an example role project with this command: molecule init role cranberry --driver-name docker If you pull it: git clone git@github.com:natemarks/cranberry.git and run it: make clean-venv && make molecule-test It should set up the…
Nate Marks
  • 197
  • 1
  • 6
1
vote
1 answer

How to test a role with molecule that uses the rhsm_repository module?

One of my ansible roles calls the rhsm_repository module: - name: Enable Red Hat Software Collections repo rhsm_repository: name: rhel-server-rhscl-7-rpms when: ( ansible_os_family == "RedHat" and ansible_facts['distribution_major_version']…
Bram
  • 819
  • 1
  • 9
  • 24
1 2
3
9 10