Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Molecule aids in the development, and testing of Ansible roles.

Project Description

Molecule is designed to aid in the development and testing of Ansible roles including 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.

Ansible Support

  • 2.1.5.0 - Supported
  • 2.2.2.0 - Supported
  • 2.3.0.0 - Supported

Dependencies

Molecule relies on several outside packages and programs to function.

Verifier

Driver

Quick Start

Important

Ansible and the driver’s python package require installation.

Install OS dependencies on CentOS 6/7

$ yum install -y epel-release
$ yum install gcc python-devel openssl-devel libffi-devel

Install OS dependencies on Ubuntu 16.x

$ apt-get update
$ apt-get install gcc python-pip python-vagrant libssl-dev libffi-dev

Install Molecule using pip:

$ pip install ansible
$ pip install docker
$ pip install molecule

Create a new role with the docker driver:

$ molecule init --role foo --driver docker
--> Initializing role foo...
Successfully initialized new role in /private/tmp/foo.

Or add Molecule to an existing role:

$ cd foo
$ molecule init --driver docker
--> Initializing molecule in current directory...
Successfully initialized new role in /private/tmp/foo.

Update the role with needed functionality and tests. Now test it:

$ cd foo
$ molecule test
--> Destroying instances...
--> Checking playbook's syntax...

playbook: playbook.yml
--> Creating instances...
Creating container foo with base image ubuntu:latest...
Container created.
--> Starting Ansible Run...

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [foo]

PLAY RECAP *********************************************************************
foo                        : ok=1    changed=0    unreachable=0    failed=0

--> Idempotence test in progress (can take a few minutes)...
--> Starting Ansible Run...
Idempotence test passed.
--> Performing a 'Dry Run' of playbook...

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [foo]

PLAY RECAP *********************************************************************
foo                        : ok=1    changed=0    unreachable=0    failed=0

--> Executing ansible-lint...
--> Executing flake8 on *.py files found in tests/...
--> Executing testinfra tests found in tests/...
============================= test session starts ==============================
platform darwin -- Python 2.7.12, pytest-3.0.4, py-1.4.31, pluggy-0.4.0
rootdir: /private/tmp/foo, inifile: pytest.ini
plugins: testinfra-1.4.4
collected 1 itemss

tests/test_default.py .

============================ pytest-warning summary ============================
WP1 None Modules are already imported so can not be re-written: testinfra
================= 1 passed, 1 pytest-warnings in 0.89 seconds ==================
--> Destroying instances...
Stopping container foo...
Removed container foo.

License

MIT

The logo is licensed under the Creative Commons NoDerivatives 4.0 License. If you have some other use in mind, contact us.

Release History

Release History

History Node

2.0.0.0rc16

History Node

2.0.0.0rc15

History Node

2.0.0.0rc14

History Node

2.0.0.0rc13

History Node

2.0.0.0rc12

History Node

2.0.0.0rc11

History Node

2.0.0.0rc10

History Node

2.0.0.0rc9

History Node

2.0.0.0rc8

History Node

2.0.0.0rc7

History Node

2.0.0.0rc6

History Node

2.0.0.0rc5

History Node

2.0.0.0rc4

History Node

2.0.0.0rc3

History Node

2.0.0.0rc2

History Node

2.0.0.0rc1

This version
History Node

1.25.0

History Node

1.24.0

History Node

1.23.3

History Node

1.23.2

History Node

1.23.1

History Node

1.23.0

History Node

1.22.0

History Node

1.21.1

History Node

1.21.0

History Node

1.20.3

History Node

1.20.2

History Node

1.20.1

History Node

1.20.0

History Node

1.19.3

History Node

1.19.2

History Node

1.19.1

History Node

1.19.0

History Node

1.18.1

History Node

1.18.0

History Node

1.17.3

History Node

1.17.2

History Node

1.17.1.dev4

History Node

1.17.0

History Node

1.16.1

History Node

1.16.0

History Node

1.15.0

History Node

1.14.1

History Node

1.14.0

History Node

1.13.0

History Node

1.12.6

History Node

1.12.5

History Node

1.12.4

History Node

1.12.3

History Node

1.12.2

History Node

1.12.1

History Node

1.12.0

History Node

1.11.5

History Node

1.11.4

History Node

1.11.3

History Node

1.11.2

History Node

1.11.1

History Node

1.11.0

History Node

1.10.3

History Node

1.10.2

History Node

1.10.1

History Node

1.10.0

History Node

1.9.1

History Node

1.9.0

History Node

1.8.4

History Node

1.8.3

History Node

1.8.2

History Node

1.8.1

History Node

1.8.0

History Node

1.7.0

History Node

1.6.3

History Node

1.6.2

History Node

1.6.1

History Node

1.6.0

History Node

1.5.1

History Node

1.4.2

History Node

1.4.1

History Node

1.4.0

History Node

1.3.0

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2.0

History Node

1.1.3

History Node

1.1.2

History Node

1.1.1

History Node

1.1.0

History Node

1.0.6

History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
molecule-1.25.0-py2-none-any.whl (91.3 kB) Copy SHA256 Checksum SHA256 py2 Wheel Jun 3, 2017
molecule-1.25.0.tar.gz (5.2 MB) Copy SHA256 Checksum SHA256 Source Jun 3, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting