Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

ansible-community/molecule-openstack

Repository files navigation

Molecule OpenStack Plugin

PyPI Package

Python Black Code Style

Ansible Code of Conduct

Ansible mailing lists

Repository License

Molecule OpenStack is designed to allow use of OpenStack Clouds for provisioning test resources.

Please note that this driver is currently in its early stage of development.

Installation and Usage

Install molecule-openstack and pre-requisites:

pip install molecule-openstack ansible openstacksdk

Create a new role with molecule using the openstack driver:

molecule init role <role_name> -d openstack

Configure <role_name>/molecule/default/molecule.yaml with required parameters based on your openstack cloud. A simple config is:

dependency:
   name: galaxy
driver:
   name: openstack
platforms:
- name: molecule-foo
   image: "ubuntu"
   flavor: "m1.medium"
   network: "private"
   fip_pool: "public"
   ssh_user: "ubuntu"
provisioner:
   name: ansible
verifier:
   name: ansible

Argument fip_pool in only required when network is not an external network. Instead of configuring <role_name>/molecule/default/molecule.yaml the following environment variables can be exported:

$ export MOLECULE_OPENSTACK_IMAGE=ubuntu
$ export MOLECULE_OPENSTACK_FLAVOR=m1.medium
$ export MOLECULE_OPENSTACK_NETWORK=private
$ export MOLECULE_OPENSTACK_FIP_POOL=public
$ export MOLECULE_OPENSTACK_SSH_USER=ubuntu

After this molecule can be run from the base-dir of the role:

source ~/.openrc
molecule test

Functional Tests

Functional tests can be run with tox but require access to an openstack cluster. They are not part of ci yet. To run them locally:

$ export MOLECULE_OPENSTACK_IMAGE=<image_name>
$ export MOLECULE_OPENSTACK_FLAVOR=<flavor>
$ export MOLECULE_OPENSTACK_NETWORK=<network>
$ export MOLECULE_OPENSTACK_FIP_POOL=<fip_pool_if_required>
$ export MOLECULE_OPENSTACK_SSH_USER=<ssh_user>

$ source openstack_openrc.sh

$ tox -e py38-functional   # or 39,310

Get Involved

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.