-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add openstack driver * Add openstack test scenarios default: single instance multiple: multiple instances security_group: multiple instances with different sec_groups and rules * Add openstack playbooks create: create openstack destroy: destroy openstack prepare: prepare openstack instance * Add openstack network * Add all instances to local hosts * Add openstack.cloud to requirements * Add openstack network docs * Add openstack documentation * Increase PYTEST_REQPASS to 14 * Fix lint issues * Add openstack volume * Add openstack volume test * Add openstack volume docs * Refactor openstack volume creation * Fixes from PR #157 This commit add minor fixes described in PR <#157> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update conftest imports * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Gino Naumann <[email protected]> Co-authored-by: Jack <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
fe3ceb6
commit 3407427
Showing
32 changed files
with
1,121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
************************* | ||
Molecule Openstack Plugin | ||
************************* | ||
|
||
Molecule Openstack is designed to allow use of Openstack | ||
for provisioning of test resources. | ||
|
||
.. _quickstart: | ||
|
||
Quickstart | ||
========== | ||
|
||
Installation | ||
------------ | ||
|
||
.. code-block:: bash | ||
pip install molecule-plugins | ||
Create a scenario | ||
----------------- | ||
|
||
In a pre-existing role | ||
^^^^^^^^^^^^^^^^^^^^^^ | ||
.. code-block:: bash | ||
molecule init scenario -d openstack | ||
This will create a default scenario with the openstack driver | ||
in a molecule folder, located in the current working directory. | ||
|
||
Example | ||
------- | ||
This is a molecule.yml example file | ||
|
||
.. code-block:: yaml | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: openstack | ||
platforms: | ||
- name: ubuntu2004 | ||
flavor: m1.small | ||
image: Ubuntu_22.04 | ||
user: ubuntu | ||
provisioner: | ||
name: ansible | ||
Then run | ||
|
||
.. code-block:: bash | ||
molecule test | ||
.. note:: | ||
You need to configure `openstack authentication <https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html#config-environment-variables>` using config file or environment variables. | ||
|
||
Documentation | ||
============= | ||
|
||
Details on the parameters for the platforms section are detailed in | ||
`<platforms.rst>`__. | ||
|
||
.. _license: | ||
|
||
License | ||
======= | ||
|
||
The `MIT`_ License. | ||
|
||
.. _`MIT`: https://github.com/ansible/molecule/blob/master/LICENSE | ||
|
||
The logo is licensed under the `Creative Commons NoDerivatives 4.0 License`_. | ||
|
||
If you have some other use in mind, contact us. | ||
|
||
.. _`Creative Commons NoDerivatives 4.0 License`: https://creativecommons.org/licenses/by-nd/4.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
********************* | ||
Options documentation | ||
********************* | ||
|
||
Authentication | ||
============== | ||
|
||
See https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html#config-environment-variables | ||
|
||
Platform Arguments | ||
================== | ||
|
||
=============================== =============================================== | ||
Variable Description | ||
=============================== =============================================== | ||
description Set description for instance, \ | ||
default = 'Molecule test instance' | ||
flavor Set flavor for instance | ||
image Set instance image | ||
network Mapping of network settings (optional) | ||
network.name Name of network | ||
network.create Create network, default = true | ||
network.router Mapping of network router settings | ||
network.router.name Name of router | ||
network.router.ext_network External gateway network | ||
network.router.snat Enable or disable snat, default = omit | ||
network.subnet Mapping of network subnet settings | ||
network.subnet.name Name of subnet | ||
network.subnet.cidr CIDR of subnet | ||
network.subnet.ipv IP Version, default = 4 | ||
network.subnet.dns_nameservers List of dns nameservers, default = omit | ||
network.subnet.host_routers List of host router (destination, nexthop), \ | ||
default = omit | ||
security_group Mapping of security_group settings (optional) | ||
security_group.name Name of security_group | ||
security_group.create Create security group, default = true | ||
security_group.description Description of security_group | ||
security_group.rules Ingress Rules (list) defined in security_group | ||
security_group.rules[].proto Protocol for rule | ||
security_group.rules[].port Port | ||
security_group.rules[].cidr Source IP address(es) in CIDR notation | ||
security_group.rules[].port_min Starting port (can't be used with port) | ||
security_group.rules[].port_max Ending port (can't be used with port) | ||
security_group.rules[].type IPv4 or IPv6, default 'IPv4' | ||
user Default user of image | ||
volume Mapping of volume settings (optional if \ | ||
flavor provides volume) | ||
volume.size Size of volume (GB) | ||
=============================== =============================================== | ||
|
||
|
||
Image User | ||
========== | ||
|
||
More information: https://docs.openstack.org/image-guide/obtain-images.html | ||
|
||
Security Groups | ||
=============== | ||
|
||
If you specifiy a security group, | ||
the security group will be managed by create and destroy playbook. | ||
You can define some rules (see example below). | ||
|
||
You can use unmanaged security groups by specifying the name of the group | ||
and setting `create` to `false` (see debian11 example below). | ||
In this case, the specified security group must exist. | ||
|
||
Networks | ||
======== | ||
|
||
If you specify a network, | ||
the network will be managed by create and destroy playbook. | ||
You need to define a subnet and router (see example below). | ||
|
||
You can use unmanaged network by specifying the name of the network | ||
and setting `create` to `false`. | ||
In this case, the specified network must exist. | ||
|
||
|
||
Volumes | ||
======= | ||
|
||
If you specify a volume, | ||
the volume will be managed by create and destroy playbook. | ||
You need to define the size of the volume. | ||
|
||
This setting is required if your flavor doesn't provide a disk. | ||
|
||
Examples | ||
======== | ||
|
||
.. code-block:: yaml | ||
platforms: | ||
- name: debian10 | ||
flavor: m1.small | ||
image: Debian_10 | ||
user: debian | ||
network: | ||
name: molecule | ||
router: | ||
name: router1 | ||
ext_network: public | ||
subnet: subnet1 | ||
subnet: | ||
name: subnet1 | ||
cidr: 192.168.11.0/24 | ||
ipv: 4 # default | ||
dns_nameservers: # default omit | ||
- 8.8.8.8 | ||
host_routes: # default omit | ||
- destination: 192.168.0.0/24 | ||
nexthop: 192.168.0.1 | ||
security_group: | ||
name: molecule | ||
description: Molecule test | ||
rules: | ||
- proto: tcp | ||
port: 22 | ||
cidr: 0.0.0.0/0 | ||
- proto: tcp | ||
port: 22 | ||
cidr: '::/0' | ||
type: IPv6 | ||
- proto: icmp | ||
port: -1 | ||
cidr: 0.0.0.0/0 | ||
- proto: tcp | ||
port_min: 5000 | ||
port_max: 5050 | ||
cidr: 0.0.0.0/0 | ||
- name: debian11 | ||
flavor: m1.small | ||
image: Debian_11 | ||
user: debian | ||
security_group: | ||
name: existing-sec | ||
create: false | ||
network: | ||
name: molecule # use network from debian10 instance | ||
- name: ubuntu2004 | ||
falvor: m1.tiny | ||
image: Ubuntu_2004 | ||
user: ubuntu | ||
security_group: | ||
name: molecule # use security group from debian10 instance | ||
network: | ||
name: existing-net # use existing network | ||
create: false | ||
volume: | ||
size: 10 # GB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ collections: | |
- name: community.crypto | ||
version: ">=1.8.0" | ||
- name: community.vagrant | ||
- name: openstack.cloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Molecule Openstack Driver.""" |
5 changes: 5 additions & 0 deletions
5
src/molecule_plugins/openstack/cookiecutter/cookiecutter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"molecule_directory": "molecule", | ||
"role_name": "OVERRIDDEN", | ||
"scenario_name": "OVERRIDDEN" | ||
} |
7 changes: 7 additions & 0 deletions
7
...kiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/converge.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
tasks: | ||
- name: "Include {{ cookiecutter.role_name }}" | ||
ansible.builtin.include_role: | ||
name: "{{ cookiecutter.role_name }}" |
Oops, something went wrong.