On an Ubuntu development host, test an Ansible role by installing Ansible, Molecule, and a supported scenario driver such as Podman; initializing a Molecule scenario in the role repository; applying the role in converge.yml; checking the resulting state in verify.yml; and running molecule test. Molecule creates the selected test target, runs the role, checks idempotence, executes your assertions, and removes the test resources.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What Molecule tests—and what “on Ubuntu” means
Molecule is an Ansible testing framework for developing and testing collections, playbooks, and roles. It can drive disposable containers, virtual machines, cloud infrastructure, APIs, databases, network devices, and other systems Ansible can reach. Ubuntu in this guide is the development-host operating system. Your test target can be an Ubuntu container, a virtual machine, or another platform selected by the scenario’s driver.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
That distinction matters: installing Molecule on Ubuntu does not force every test to run inside Ubuntu. The driver and scenario configuration determine where the role is exercised. A local container is usually the fastest feedback loop; a virtual machine or external host is more appropriate when the role depends on a full init system, kernel behavior, storage, networking, or distribution-specific services.
Prerequisites before creating a scenario
Install according to the project’s Python and Ansible policy
The official role workflow lists Ansible, Molecule, and Podman as prerequisites for its container example. Use the installation method required by your project—system packages, an isolated Python environment, or another approved method—and apply the project’s supported version constraints. The official tutorial does not prescribe one universal Ubuntu apt, pip, or pipx command, so copying an arbitrary command from an unrelated project can produce incompatible Python or Ansible dependencies.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Before initializing a scenario, confirm that the executables you intend to use are on your PATH and that the selected driver is usable by your account. At minimum, the following checks should return a version or help response rather than “command not found”:
ansible --versionmolecule --versionpodman --versionwhen the scenario uses Podman
Also verify that the project’s Python environment is active whenever you run Molecule. Mixing a globally installed Ansible with Molecule from a virtual environment is a common source of missing collections and plugin errors.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Choose the target and driver deliberately
| Choice | Best fit | Trade-off |
|---|---|---|
| Disposable container | Fast role feedback, package and file configuration, service setup that does not require a full VM | Container limitations can hide problems involving boot, kernel, privileged operations, or hardware |
| Virtual machine | Roles that require a complete operating-system environment, system services, reboots, or realistic networking | Slower creation and greater local resource use |
| Cloud or external host | Provider-specific networking, storage, identity, or integration behavior | More cost, credentials, cleanup responsibility, and potentially slower feedback |
Molecule itself does not limit you to Ubuntu targets. Select an image, connection method, and driver that your role actually supports, then record those choices in the scenario configuration.
Recommended role repository layout
Keep Molecule scenarios inside the role repository, separate from the role’s implementation files. A typical layout is:
my_role/
├── tasks/
│ └── main.yml
└── molecule/
└── default/
├── molecule.yml
├── requirements.yml
├── inventory/
│ └── hosts.yml
├── create.yml
├── converge.yml
├── verify.yml
└── destroy.yml
default is the conventional scenario name, not a requirement. Every scenario directory is self-contained and can define its own driver, inventory, lifecycle sequence, variables, and assertions. Keep additional scenarios beside it when the role needs different operating systems, drivers, or input combinations.
Initialize the default Molecule scenario
- Change to the root of the role you want to test:
cd my_role
- Initialize the conventional scenario:
molecule init scenario default
- Inspect the generated
molecule/defaultdirectory before editing it. Treat generated files as a starting point: the driver, inventory, lifecycle actions, and verification logic must match your role and project policy.
If the scenario needs a driver collection, declare it in molecule/default/requirements.yml. The official container example uses the containers.podman collection:
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
---
collections:
- name: containers.podman
Install scenario dependencies using the dependency mechanism configured by your project before the first run. Do not assume that a collection is available merely because the executable for its underlying tool is installed.
Configure the files in molecule/default
molecule.yml: driver, inventory, and sequence
molecule.yml is the scenario’s control file. Configure the Ansible settings, the driver or provider, the inventory source, and the action sequence. The role must remain discoverable from the project layout; if you run Molecule from a different directory or use a nonstandard repository structure, make the role path explicit in the project configuration rather than relying on an accidental working directory.
The scenario sequence determines which lifecycle actions run and in what order. The standard role workflow is:
| Stage | Purpose |
|---|---|
dependency |
Resolve collections or other scenario dependencies. |
destroy |
Remove stale resources from an earlier or interrupted run. |
create |
Provision the test instance or instances. |
converge |
Apply the role under test. |
idempotence |
Apply the role again and detect changes that should not recur. |
verify |
Run assertions against the resulting state. |
destroy |
Clean up the resources at the end. |
You can customize the sequence for a legitimate testing need, but removing creation, idempotence, verification, or cleanup changes what “test” means. Keep the complete sequence for continuous integration unless the project intentionally delegates a stage elsewhere.
inventory/hosts.yml: identify the Molecule group
Your inventory must expose the instances to the group used by the playbooks. The official pattern targets a group named molecule. Ensure the driver-generated host names, connection variables, and group membership agree with that choice. A mismatch here produces an apparently successful play that matched no hosts—or a play that cannot connect—before the role is ever evaluated.
converge.yml: apply only the role under test
Convergence is the playbook that puts the system into the state your role promises. A minimal role-focused play is:
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
---
- name: Converge
hosts: molecule
gather_facts: false
tasks:
- name: Apply the role under test
ansible.builtin.include_role:
name: my_role
Replace my_role with the role’s actual name. Add variables, tags, or prerequisite tasks only when they represent a real supported use case. Keeping this play small makes a failure attributable to the role instead of to an elaborate test harness. Enable fact gathering when the role requires facts; otherwise disabling it shortens the loop and removes an unnecessary dependency.
verify.yml: assert observable outcomes
Verification should inspect the system rather than merely report that Ansible completed. Use modules such as stat, service_facts, command, or a purpose-built check, then fail with ansible.builtin.assert when the promised state is absent. For example, this verifies a marker file:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
---
- name: Verify
hosts: molecule
gather_facts: false
tasks:
- name: Read the role marker file
ansible.builtin.stat:
path: /tmp/molecule_role_marker
register: marker
- name: Confirm the role created the marker file
ansible.builtin.assert:
that:
- marker.stat.exists
- marker.stat.isreg
Replace the marker with behavior that matters to users of your role: a configuration value, a package, a running service, a file owner and mode, a listening port, or a safe command result. Assertions should check the final contract, not an internal implementation detail that could change during a refactor.
create.yml and destroy.yml: own the test resources
These playbooks implement provisioning and cleanup for the selected driver. For a managed driver, the driver plugin may provide most of the behavior; for a custom or external target, the files may contain the project’s creation and destruction logic. Make cleanup reliable even after a partial failure. Leaked containers, virtual machines, or cloud resources make later failures misleading and can incur charges.
Run the complete test
From the role directory, run:
molecule test
This command follows the configured end-to-end sequence: dependencies, stale-resource cleanup, creation, convergence, idempotence, verification, and final destruction. A passing command means the configured assertions passed and the scenario completed its cleanup; it does not prove every possible operating system, variable combination, or external integration is correct.
The idempotence stage is especially valuable. Molecule applies the role a second time and checks whether tasks report unexpected changes. A role that continually rewrites a file, recreates a resource, or changes permissions on every run may still produce the desired first-run state but is not safely repeatable.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Use faster loops during development
Apply the role without rebuilding everything
When an instance already exists, use:
molecule converge
This reapplies converge.yml and is the quickest way to iterate on task logic and variables. It does not replace a clean end-to-end run: stale state can conceal provisioning problems, and convergence alone does not run your verification playbook.
Run assertions against an existing instance
molecule verify
Use verify after a successful or intentionally paused convergence when you only changed assertions or want to inspect the current result. It assumes the scenario instance exists and is reachable.
Inspect and enter the instance
- Create the instance without necessarily running the whole sequence:
molecule create
- List Molecule’s view of scenario state:
molecule list
- Open an interactive session to the instance:
molecule login
Use the session to inspect files, users, permissions, processes, and service logs. Exit the session and remove the instance when finished:
molecule destroy
Keep a failed instance for diagnosis
By default, the test sequence destroys resources at the end, including after many failures. To preserve a failed instance for inspection, run:
Free tools Windows power users keep installed
One-click scans. No signup required.
molecule test --destroy=never
After diagnosing the problem, clean up explicitly with molecule destroy. Leaving resources behind can contaminate the next run and, for externally managed infrastructure, may create ongoing cost or security exposure.
Debug failures systematically
The command is missing or a plugin cannot load
- Check that the intended Python environment is active.
- Run the version checks for Ansible, Molecule, and the driver executable.
- Confirm required collections are declared in
requirements.ymland installed for the same environment that runs Molecule. - Check the project’s supported Ansible and Python window before changing versions; an unplanned upgrade can break a driver or collection.
No hosts matched, or Ansible cannot connect
- Compare the
hosts:value inconverge.ymlandverify.ymlwith the inventory group. The documented example usesmolecule. - Inspect
molecule listto confirm that the instance was created. - Check connection variables, generated host names, and credentials in the scenario inventory.
- Run with debug output or increased Ansible verbosity to expose the resolved inventory and connection method.
The role fails during convergence
- Run
molecule converge --debugand increase verbosity when necessary. - Use
molecule test --destroy=neverif you need the failed filesystem or service state. - Enter with
molecule loginand inspect the exact path, package database, service status, environment, and permissions named by the failing task. - Check whether the container lacks a capability or init system that the role assumes. If so, switch to a more suitable driver or target rather than weakening the role’s production behavior solely to satisfy an unsuitable test image.
Idempotence fails
Look at the task reported as changed on the second convergence. Common causes include commands without a stable changed_when policy, templates whose input varies between runs, unordered data, generated timestamps, and resources that are recreated instead of updated. Fix the task so a second application reports no change when the desired state is already present, then rerun convergence and the complete test.
Best Value
Verification fails after convergence succeeds
A successful convergence only means Ansible did not report an error. Read the assertion message and inspect the target. Verify that the check tests the intended contract, uses the correct path or service name, and accounts for the target’s platform. If the role supports several modes, express those modes as separate scenarios or explicit variables instead of making one assertion ambiguous.
Cleanup fails
Preserve the instance when necessary, collect diagnostics, and run molecule destroy directly. Review custom destruction logic and credentials if external resources remain. A scenario is not operationally complete until it can reliably remove what it created.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteTest more than one Ubuntu or platform case
When behavior varies by input or platform, create additional scenario directories rather than overloading default with unrelated conditionals. Each scenario can select a different image, driver, inventory, variables, and assertion set. A practical Ubuntu matrix might vary the target image or connection driver, but there is no universal image-tag matrix that applies to every role; choose combinations supported by your project and verify them in your environment.
Without shared state, each scenario creates and destroys its own resources. With shared_state: true, the default scenario owns creation and destruction while component scenarios perform their convergence, idempotence, and verification work against the shared instance. Shared state can reduce setup time, but it introduces ordering and contamination risks: one scenario can leave files, packages, or services that change another scenario’s result. Prefer isolated scenarios unless the project intentionally needs shared infrastructure.
What a useful Molecule test suite should prove
- Provisioning: the declared driver can create the target from a clean start.
- Convergence: the role applies successfully with the variables and privileges its users are expected to provide.
- Idempotence: applying the role again does not make unjustified changes.
- Observable state: verification checks the files, packages, services, permissions, ports, or other outcomes that matter to consumers.
- Cleanup: the scenario destroys its resources, including after interrupted or failed runs.
- Coverage: additional scenarios represent materially different platforms, inputs, or integration paths.
Simple Ansible assertions are often sufficient, but a project can add another verifier when its requirements demand deeper integration checks. Keep the assertion layer close to the role’s public contract and document any assumptions about privileges, network access, service managers, or target images.
A repeatable Ubuntu workflow
- Read the role’s supported Ansible, Python, operating-system, and driver constraints.
- Install or activate Ansible, Molecule, and the chosen driver in that supported environment.
- Initialize
molecule/defaultfrom the role directory. - Declare and install required driver collections.
- Align
molecule.yml, inventory, and themoleculehost group. - Write a minimal
converge.ymlthat includes the role. - Write
verify.ymlassertions for the role’s externally visible behavior. - Use
create,list,login,converge, andverifyfor a fast development loop. - Run
molecule testfrom a clean state before committing or sending changes to continuous integration. - When a run fails, preserve the instance if needed, diagnose with debug output and an interactive login, then destroy it explicitly.
This workflow keeps the Ubuntu host, the selected test target, the role’s implementation, and the assertions clearly separated. That separation is what makes a Molecule failure actionable instead of merely reporting that an Ansible play ended.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




