Skip to main content

EC2 Molecule Plugin :: run molecule tests using AWS EC2

Project description

PyPI Package https://zuul-ci.org/gated.svg Python Black Code Style Ansible Code of Conduct Ansible mailing lists Repository License

Molecule EC2 is designed to allow use of AWS EC2 for provisioning of test resources.

Quickstart

Installation

pip install molecule-ec2

Create a scenario

With a new role

molecule init role -d ec2 my-role

This will create a new folder my-role containing a bare-bone generated role like you would do with ansible-galaxy init command. It will also contain a molecule folder with a default scenario using the ec2 driver (using ansible community.aws.ec2_instance collection). Install the collection using ansible-galaxy install -r test_requirements.yml.

In a pre-existing role

molecule init scenario -d ec2

This will create a default scenario with the ec2 driver in a molecule folder, located in the current working directory.

Example

This is a molecule.yml example file

dependency:
   name: galaxy
driver:
   name: ec2
platforms:
  - name: instance
    image_owner: 099720109477
    image_name: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*
    instance_type: t2.micro
    vpc_subnet_id: <your-aws-vpc-subnet-id>
    tags:
      - Name: molecule_instance
provisioner:
  name: ansible
verifier:
  name: ansible

All you need to do is fill in the subnet-id you want to create your test instance into. Then run

molecule test

Documentation

Read the documentation and more at https://molecule.readthedocs.io/.

Get Involved

Authors

Molecule EC2 Plugin was created by Sorin Sbarnea based on code from Molecule.

License

The MIT License.

The logo is licensed under the Creative Commons NoDerivatives 4.0 License.

If you have some other use in mind, contact us.

Project details


Download files

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

Source Distribution

molecule-ec2-0.4.tar.gz (20.8 kB view hashes)

Uploaded Source

Built Distribution

molecule_ec2-0.4-py3-none-any.whl (21.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page