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
1
vote
1 answer

ansible ... molecule.yml - how to refer to env variables define in same file?

I cam trying to restructure a molecule file to use a common playbook to reduce code duplication. I can get it to work with a relative path but using referring to the other playbook relative to env var like ANSIBLE_ROLES_PATH would be more intuitive.…
k1eran
  • 4,492
  • 8
  • 50
  • 73
1
vote
1 answer

How to fix template error while templating string: no filter named 'molecule_from_yaml' with molecule ec2 driver

I am running a Molecule v2.22 and I am want to spin up an ec2 instance using molecule, to test my ansible playbooks. But I am hitting an error when molecule gets to the Detroy and create stage of the instance. I also don't understand why molecule…
Mpho Mokgosi
  • 35
  • 1
  • 2
  • 10
1
vote
1 answer

Molecule complaining about "[703] Should change default metadata: description" while running the basic test

I couldn't run the molecule test command as it throws below error, while I can run individual commands without any errors ( Also provided --debug o/p below) [701] Role info should contain…
change198
  • 1,647
  • 3
  • 21
  • 60
1
vote
1 answer

How to I run molecule testing for a specific or custom platform?

I do know that I can add multiple platforms inside molecule.yml but something I may want to run a test on a new/experimental one, or I may have one platform which is not freely available so I cannot commit changes to the molecule.yml file.
bogdan
  • 9,056
  • 10
  • 37
  • 42
1
vote
1 answer

Ansible/molecule: service docker daemon/engine won’t start

The service module seems not to start my docker daemon after explicitly passing the commands. Ansible is not starting up docker daemon in the destination host. Tasks: - name: Install Docker apt: name: docker-engine state: present …
Rafael Oliveira
  • 309
  • 2
  • 11
1
vote
0 answers

How to use Molecule inside a VM to test an Ansible role that installs Docker

I have an Ansible role that among other things installs Docker and starts the docker daemon in a CentOS environment. I would like to use Molecule to test it, but as my workstation is a Windows PC I have to run Molecule from a VirtualBox VM. At least…
Nicola Musatti
  • 17,834
  • 2
  • 46
  • 55
1
vote
0 answers

How should I test a role in molecule with various calling methods?

Assuming the I have the foo role which I am testing via the foo molecule scenario on several platforms. My playbook.yml current looks like: - import_role: name: foo Now I do want to check if calling the same role with some optional variable…
sorin
  • 161,544
  • 178
  • 535
  • 806
1
vote
0 answers

Testinfra not seeing nginx when run through Molecule

I don't understand what I am missing. I am trying to run a basic test from the documentation to see if my Ansible role deploys and runs nginx. I can login to the VM and verify, but that defeats the purpose of using molecule. All testinfra and…
user982599
  • 975
  • 13
  • 28
1
vote
1 answer

How to log in molecule?

I am using Molecule to test an Ansible role. I've written unit tests in python, and have been unable to print out variables or log anything to stdout. Here is my code import os import testinfra.utils.ansible_runner import logging LOG =…
pgrandjean
  • 676
  • 1
  • 9
  • 19
1
vote
1 answer

How not to destroy container upon failure

Is there a way to have molecule not destroy the docker container that was created upon a failure? I have the following scenario in molecule.yml: scenario: name: default test_sequence: - create - converge - verify One of the…
E. Jaep
  • 2,095
  • 1
  • 30
  • 56
1
vote
1 answer

How to access from one instance to another using molecule

I'm trying to use ansible-mongodb-cluster scripts to create a mongodb cluster. I've edited hosts in order to have just a primary and a slave. I use molecule with vagrant to test it. this is my molecule.yml ansible: playbook: 01_create_cluster.yml …
Jayyrus
  • 12,961
  • 41
  • 132
  • 214
0
votes
0 answers

How should my data to apply of technique time-lagged independent component analysis (TICA)?

I am trying to apply TICA to reduce dimensions to some data: reader = pyemma.coordinates.source(files, top=pdb) reader.featurizer.add_backbone_torsions(periodic=False) (add feature) tica = pyemma.coordinates.tica(reader) (perform tica on feature…
0
votes
0 answers

Ansible indempotence check is failing despite adding the changed_when flag with false value

I have below ansible task which removes python command. - name: Ensure python is not present shell: rpm -ev --nodeps python changed_when: false when I run either of the below commands molecule test molecule idempotence The idemptence check is…
Rob Wilkinson
  • 1,131
  • 5
  • 18
  • 34
0
votes
0 answers

Coodinates generate and molecule functionnalization

I need help please. Can someone guide me on how to generate the xyz coordinates of all functionalized Azulene molecules knowing the positions of the functional groups (1,3,9) and the functional groups (C(CN)2, COCH3, Br)? I search the answer on the…
0
votes
0 answers

Why Ansible molecule path is not detected? molecule: command not found

I tried to init molecule init role mikitovcluster got molecule: command not found I listed my collections ansible-galaxy collection list # /usr/lib/python3/dist-packages/ansible_collections Collection …
Richard Rublev
  • 7,718
  • 16
  • 77
  • 121